pkgs/clerie-sops: Do not write back unchanged values in clerie-sops-edit
This commit is contained in:
parent
e413204215
commit
730903d0d8
@ -16,8 +16,17 @@ TMP_FILE="$(mktemp)"
|
||||
|
||||
clerie-sops --decrypt --extract "[\"${KEY}\"]" "${SECRETS_FILE}" > "${TMP_FILE}"
|
||||
|
||||
TMP_FILE_HASH_BEFORE="$(sha256sum "${TMP_FILE}")"
|
||||
|
||||
vim "${TMP_FILE}"
|
||||
|
||||
TMP_FILE_HASH_AFTER="$(sha256sum "${TMP_FILE}")"
|
||||
|
||||
# Don't write value back when it hasn't changed
|
||||
if [[ "${TMP_FILE_HASH_BEFORE}" == "${TMP_FILE_HASH_AFTER}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
JSON_QUOTED_SECRET="$(jq -Rs '.' "${TMP_FILE}")"
|
||||
|
||||
rm "${TMP_FILE}"
|
||||
|
Loading…
Reference in New Issue
Block a user