summaryrefslogtreecommitdiffstats
path: root/tools/gpg-authcode-sign.sh
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2024-08-16 11:12:44 +0200
committerWerner Koch <wk@gnupg.org>2024-08-16 11:12:44 +0200
commit2f46029bec73437d8283525d1305fde985bd5517 (patch)
treea9dcaac03078ae18e1d2a0ea0d2102169647bce5 /tools/gpg-authcode-sign.sh
parentbuild-aux: Add PKCS#8 authenticode key support (diff)
downloadgnupg2-2f46029bec73437d8283525d1305fde985bd5517.tar.xz
gnupg2-2f46029bec73437d8283525d1305fde985bd5517.zip
tools: Fix bashishm
-- Fixes-commit: 536fc8d33db571108459493d1881cdfc8371d3cc
Diffstat (limited to 'tools/gpg-authcode-sign.sh')
-rwxr-xr-xtools/gpg-authcode-sign.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/gpg-authcode-sign.sh b/tools/gpg-authcode-sign.sh
index 615e1bac7..1bc71559f 100755
--- a/tools/gpg-authcode-sign.sh
+++ b/tools/gpg-authcode-sign.sh
@@ -184,15 +184,16 @@ if [ ! -f $autogenrc ]; then
fi
# Define the cleanup routine for osslsigncode
-cleanup() {
- if [[ -n "$outname" && -f "${outname}.tmp" ]]; then
- echo "Cleaning up: Removing ${outname}.tmp"
+cleanup()
+{
+ if [ -n "$outname" && -f "${outname}.tmp" ]; then
+ echo >&2 "Cleaning up: Removing ${outname}.tmp"
rm -f "${outname}.tmp"
fi
}
-# Trap any error to call the cleanup routine
-trap cleanup ERR SIGINT SIGTERM
+# Trap common signals and exit to run the cleanup
+trap cleanup 0 SIGINT SIGTERM
for v in AUTHENTICODE_SIGNHOST AUTHENTICODE_TOOL AUTHENTICODE_TSURL \
AUTHENTICODE_KEY AUTHENTICODE_CERTS VERSION_SIGNKEY \
@@ -261,7 +262,7 @@ elif [ "$AUTHENTICODE_KEY" = none ]; then
echo >&2 "$PGM: Signing disabled; would sign: '$inname'"
[ "$inname" != "$outname" ] && cp "$inname" "$outname"
-elif [[ "$AUTHENTICODE_KEY" =~ \.p12$ || "$AUTHENTICODE_KEY" =~ \.pfx$ ]]; then
+elif [ -n $(echo "$AUTHENTICODE_KEY" | egrep "\.(pfx|p12)$") ]; then
echo >&2 "$PGM: Signing using PKCS#12 container $AUTHENTICODE_KEY"
osslsigncode sign -certs "$AUTHENTICODE_CERTS" \