safe quote remove-keygrips.sh

pull/359/head
drduh 2022-12-26 10:54:14 -08:00
parent 3572d911b5
commit 90a3ebc546
1 changed files with 4 additions and 4 deletions

View File

@ -1303,7 +1303,7 @@ $ sudo cp -avi $GNUPGHOME /mnt/encrypted-storage/
$ sudo cp onerng_3.6-1_all.deb /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: 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 $ 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: 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 ```console
$ cat >> ~/scripts/remove-keygrips.sh <<EOF $ cat >> ~/scripts/remove-keygrips.sh <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
test ! "$@" && echo "Specify a key." && exit 1 (( $# )) || { echo "Specify a key." >&2; exit 1; }
KEYGRIPS="$(gpg --with-keygrip --list-secret-keys $@ | grep Keygrip | awk '{print $3}')" KEYGRIPS=$(gpg --with-keygrip --list-secret-keys "$@" | awk '/Keygrip/ { print $3 }')
for keygrip in $KEYGRIPS for keygrip in $KEYGRIPS
do do
rm "$HOME/.gnupg/private-keys-v1.d/$keygrip.key" 2> /dev/null rm "$HOME/.gnupg/private-keys-v1.d/$keygrip.key" 2> /dev/null