aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-05-03 15:33:43 -0400
committerCarl Dong <contact@carldong.me>2021-05-03 16:50:59 -0400
commitd420e5c1c015f58d07aca4d6a805086488f74d03 (patch)
treee8522164b3f7b83ed18b5aa2db7f4886eabde0dc /contrib
parentfeda2c8e3180cb983c35976d4440cea23a155b7f (diff)
guix-attest: Avoid incomplete sigdirs with ERR traps
Sometimes GPG connects to the wrong agent... or you don't have your smartcard handy...
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/guix/guix-attest5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/guix/guix-attest b/contrib/guix/guix-attest
index 8b4746caf9..081d1c0465 100755
--- a/contrib/guix/guix-attest
+++ b/contrib/guix/guix-attest
@@ -156,6 +156,9 @@ for outdir in "${OUTDIRS[@]}"; do
echo "${outname}: SKIPPING: Signature directory already exists in the specified guix.sigs repository"
outdirs_already_attested_to+=("$outdir")
else
+ # Clean up incomplete sigdir if something fails (likely gpg)
+ trap 'rm -rf "$outsigdir"' ERR
+
mkdir -p "$outsigdir"
(
@@ -182,6 +185,8 @@ for outdir in "${OUTDIRS[@]}"; do
echo "${outname}: Not signing SHA256SUMS as \$NO_SIGN is not empty"
fi
echo ""
+
+ trap - ERR # Reset ERR trap
fi
done