1

When running.

sudo apt-get update

For example something like this could happen.

W: GPG error: http://deb.torproject.org wheezy Release: The following signatures were invalid: KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681

(This question is not about this particular example warning. It has already been reported.)

Exit code.

echo $?
0

Exit code 0 is problematic for automated use in scripts, where success is expected.

This is a bug in Debian's apt-get:
apt: Provide meaningful exit codes for gpg failures

How to notice GPG errors in scripts when the exit code is not reliable?

1

Make a wrapper script around /usr/bin/gpgv. Supply the pathname to the wrapper script as the value of Dir::Bin::gpg (using apt-get --option). Have the wrapper script examine the output and exit status of gpgv, and communicate failure back to the toplevel script somehow (I suggest using kill to send a signal).

  • I'm really a noob at bash scripting, could you give me an example on that? – DarkLite1 May 1 '16 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.