From a77765d09838099dbbb9cfc971765f377dad6577 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 1 Oct 2016 16:36:56 +0000 Subject: Fix "user no longer has key" scenario step This used to assume things of gpg's output, which break when gpg becomes version 2.1.something. This changed version of the step should hopefully work with either version of gpg. --- yarns/9000-implements.yarn | 10 +++++++++- yarns/obnam.sh | 5 ++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'yarns') diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 1ae52444..1d898d7c 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -511,8 +511,16 @@ Forget a key from the user's keyring. IMPLEMENTS WHEN user (\S+) no longer has key "(.+)" export GNUPGHOME="$DATADIR/$MATCH_1.gnupg" + ls -la "$GNUPGHOME" + echo fingerprints + gpg --fingerprint "$MATCH_2" + echo with colons + gpg --fingerprint --with-colons "$MATCH_2" + echo just fingeprint + gpg --fingerprint --with-colons "$MATCH_2" | + awk -F: '{ print } /^fpr:/ { print $10; exit }' fingerprint="$(get_fingerprint "$MATCH_2")" - gpg --batch --delete-secret-key "$fingerprint" + gpg --batch --yes --delete-secret-key "$fingerprint" Lock management diff --git a/yarns/obnam.sh b/yarns/obnam.sh index b567eea4..201ffc3c 100644 --- a/yarns/obnam.sh +++ b/yarns/obnam.sh @@ -183,9 +183,8 @@ manifest() get_fingerprint() { - gpg --fingerprint "$1" | - sed -n '/^ *Key fingerprint = /s///p' | - sed 's/ *//g' + gpg --fingerprint --with-colons "$1" | + awk -F: '/^fpr:/ { print $10; exit }' } -- cgit v1.2.1