diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-10-01 16:36:56 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-10-01 16:36:56 +0000 |
commit | a77765d09838099dbbb9cfc971765f377dad6577 (patch) | |
tree | b38b28f82014403f9f10e5c52c273e7464752620 | |
parent | e5c1d2d291394303b5c4b4190db4bcaea8576e20 (diff) | |
download | obnam-a77765d09838099dbbb9cfc971765f377dad6577.tar.gz |
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.
-rw-r--r-- | yarns/9000-implements.yarn | 10 | ||||
-rw-r--r-- | yarns/obnam.sh | 5 |
2 files changed, 11 insertions, 4 deletions
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 }' } |