From 90a3ebc5468d73b601a4aa9cb7466c6c421fa576 Mon Sep 17 00:00:00 2001 From: drduh Date: Mon, 26 Dec 2022 10:54:14 -0800 Subject: [PATCH] safe quote remove-keygrips.sh --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 594e196..dd8b0d5 100644 --- a/README.md +++ b/README.md @@ -1303,7 +1303,7 @@ $ sudo cp -avi $GNUPGHOME /mnt/encrypted-storage/ $ sudo cp onerng_3.6-1_all.deb /mnt/encrypted-storage/ ``` -If you plan on setting up multiple keys, keep the backup mounted or remember to terminate the gpg process before [saving](https://lists.gnupg.org/pipermail/gnupg-users/2016-July/056353.html). +**Note** If you plan on setting up multiple keys, keep the backup mounted or remember to terminate the gpg process before [saving](https://lists.gnupg.org/pipermail/gnupg-users/2016-July/056353.html). Unmount, close and disconnect the encrypted volume: @@ -1385,7 +1385,7 @@ $ doas mount /dev/sd3i /mnt/encrypted-storage $ doas cp -avi $GNUPGHOME /mnt/encrypted-storage ``` -If you plan on setting up multiple keys, keep the backup mounted or remember to terminate the gpg process before [saving](https://lists.gnupg.org/pipermail/gnupg-users/2016-July/056353.html). +**Note** If you plan on setting up multiple keys, keep the backup mounted or remember to terminate the gpg process before [saving](https://lists.gnupg.org/pipermail/gnupg-users/2016-July/056353.html). Otherwise, unmount and disconnect the encrypted volume: @@ -2753,8 +2753,8 @@ Alternatively, use a script to delete the GnuPG shadowed key, where the card ser ```console $ cat >> ~/scripts/remove-keygrips.sh <&2; exit 1; } +KEYGRIPS=$(gpg --with-keygrip --list-secret-keys "$@" | awk '/Keygrip/ { print $3 }') for keygrip in $KEYGRIPS do rm "$HOME/.gnupg/private-keys-v1.d/$keygrip.key" 2> /dev/null