Commit c54a2153 authored by Joerg Jaspert's avatar Joerg Jaspert 🇩🇪

Don't let the if eat the return value away from us

parent 7adc59cd
......@@ -135,9 +135,12 @@ for file in ${KEYS}; do
if [ -f "${ARCHADMINS}/${ARCH}.gpg" ]; then
KEYRINGS="${KEYRINGS} --keyring ${ARCHADMINS}/${ARCH}.gpg"
fi
set +e
gpg ${DEFGPGOPT} ${KEYRINGS} --status-fd 4 --logger-fd 5 --decrypt "${INCOMING}/${file}" > "${GPGOUTF}"
ret=$?
set -e
# So lets run gpg, status/logger into the two files, to "decrypt" the keyfile
if ! gpg ${DEFGPGOPT} ${KEYRINGS} --status-fd 4 --logger-fd 5 --decrypt "${INCOMING}/${file}" > "${GPGOUTF}"; then
ret=$?
if [[ ${ret} -ne 0 ]]; then
log "gpg returned with ${ret}, not adding key from file ${file}"
DATE=$(date -Is)
mv "${INCOMING}/${file}" "${ERRORS}/gpgerror.${file}.${DATE}"
......
......@@ -132,8 +132,11 @@ for file in ${KEYS}; do
exec 5> "${GPGLOGS}"
# So lets run gpg, status/logger into the two files, to "decrypt" the keyfile
if ! gpg ${DEFGPGOPT} --keyring "${ADMINS}" --status-fd 4 --logger-fd 5 --decrypt "${INCOMING}/${file}" > "${GPGOUTF}"; then
ret=$?
set +e
gpg ${DEFGPGOPT} --keyring "${ADMINS}" --status-fd 4 --logger-fd 5 --decrypt "${INCOMING}/${file}" > "${GPGOUTF}"
ret=$?
set -e
if [[ ${ret} -ne 0 ]]; then
log "gpg returned with ${ret}, not removing key using ${file}"
DATE=$(date -Is)
mv "${INCOMING}/${file}" "${ERRORS}/gpgerror.${file}.${DATE}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment