From a69a3a044be84f72508fb468cdf13d9e5f724dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 28 Aug 2009 12:03:39 +0200 Subject: * cmdline/apt-key: - Emit a warning if removed keys keyring is missing and skip associated checks (LP: #218971) --- cmdline/apt-key | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-key b/cmdline/apt-key index 26aa55633..b579e5a53 100755 --- a/cmdline/apt-key +++ b/cmdline/apt-key @@ -90,13 +90,17 @@ update() { # add any security. we *need* this check on net-update though $GPG_CMD --quiet --batch --keyring $ARCHIVE_KEYRING --export | $GPG --import - # remove no-longer supported/used keys - keys=`$GPG_CMD --keyring $REMOVED_KEYS --with-colons --list-keys | grep ^pub | cut -d: -f5` - for key in $keys; do - if $GPG --list-keys --with-colons | grep ^pub | cut -d: -f5 | grep -q $key; then - $GPG --quiet --batch --delete-key --yes ${key} - fi - done + if [ -r "$REMOVED_KEYS" ]; then + # remove no-longer supported/used keys + keys=`$GPG_CMD --keyring $REMOVED_KEYS --with-colons --list-keys | grep ^pub | cut -d: -f5` + for key in $keys; do + if $GPG --list-keys --with-colons | grep ^pub | cut -d: -f5 | grep -q $key; then + $GPG --quiet --batch --delete-key --yes ${key} + fi + done + else + echo "Warning: removed keys keyring $REMOVED_KEYS missing or not readable" >&2 + fi } -- cgit v1.2.3