From 4c4860609491a98c1e4a6f03e0ba27c0a23982c0 Mon Sep 17 00:00:00 2001 From: Shiva Kaul Date: Sun, 19 Mar 2023 00:17:27 -0400 Subject: [PATCH] only backup cleartext file if it exists Avoids complaints from `cp` about nonexistent files. --- pkgs/agenix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/agenix.sh b/pkgs/agenix.sh index f638b10..b82d942 100644 --- a/pkgs/agenix.sh +++ b/pkgs/agenix.sh @@ -155,7 +155,7 @@ function edit { decrypt "$FILE" "$KEYS" || exit 1 - cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before" + [ ! -f "$CLEARTEXT_FILE" ] || cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before" [ -t 0 ] || EDITOR='cp /dev/stdin'