summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-18 18:17:56 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:38:23 +0100
commit5d90c0bc59f274b1df6d9d5fb7dc39298fecfc6b (patch)
tree57aac5df66b555580777d9f1458ff8b12498244d
parent15627167bb42468ac04d23c85aea335b2d3093fa (diff)
bin/os-conf: update
-rwxr-xr-xbin/os-conf5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/os-conf b/bin/os-conf
index 8ee143d..d6a31a1 100755
--- a/bin/os-conf
+++ b/bin/os-conf
@@ -49,11 +49,14 @@ handle_secret() {
 			tar -cz -f $archive -T - 2>/dev/null;
 			chown 1000:1000 $archive;
 		)"
+		# TODO: can we avoid re-encrypting every single time?
+		h=$(md5sum "$archive" | cut -d' ' -f1)
 		# encrypt the tarfile and amend some information that makes
 		# reconstructing easier
 		(
 			sops --config /dev/null --encrypt "$archive" 2>/dev/null |
-				jq -r '.sops.data_extension |= "tar.gz"'
+				jq -r '.sops.data_extension |= "tar.gz"' |
+				jq --arg h "$h" -r '.sops.data_hash |= $h'
 		) >"${archive}.enc"
 		printf "%s\n" "${archive}.enc"
 		;;