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" \