Merge pull request #51 from michaeladler/fix/diff-command-not-found

Make 'diff' an explicit dependency
This commit is contained in:
Ryan Mulligan 2021-07-22 06:27:35 -07:00 committed by GitHub
commit fb00f178b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,7 @@
gnused,
nix,
mktemp,
diffutils,
} :
let
# we need at least rage 0.5.0 to support ssh keys
@ -17,6 +18,7 @@ let
sedBin = "${gnused}/bin/sed";
nixInstantiate = "${nix}/bin/nix-instantiate";
mktempBin = "${mktemp}/bin/mktemp";
diffBin = "${diffutils}/bin/diff";
in
lib.recursiveUpdate (writeShellScriptBin "agenix" ''
set -Eeuo pipefail
@ -147,7 +149,7 @@ function edit {
echo "$FILE wasn't created."
return
fi
[ -f "$FILE" ] && [ "$EDITOR" != ":" ] && diff "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" 1>/dev/null && echo "$FILE wasn't changed, skipping re-encryption." && return
[ -f "$FILE" ] && [ "$EDITOR" != ":" ] && ${diffBin} "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" 1>/dev/null && echo "$FILE wasn't changed, skipping re-encryption." && return
ENCRYPT=()
while IFS= read -r key