summaryrefslogtreecommitdiff
path: root/localgpgcleankeyring
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2015-08-06 13:35:07 +0200
committerJonas Smedegaard <dr@jones.dk>2015-08-06 13:35:07 +0200
commite8620944aca253db14b44a62ae167ad86565ae79 (patch)
treefbebb3bba00924d2662d5e60b916c644281e6227 /localgpgcleankeyring
parente038a36b16ba7a10e1a591eb6e622f3bb75d73f7 (diff)
Tighten gpg calls with --with-colons option.
Diffstat (limited to 'localgpgcleankeyring')
-rwxr-xr-xlocalgpgcleankeyring6
1 files changed, 3 insertions, 3 deletions
diff --git a/localgpgcleankeyring b/localgpgcleankeyring
index 0662135..0be9c67 100755
--- a/localgpgcleankeyring
+++ b/localgpgcleankeyring
@@ -4,7 +4,7 @@
# origin: https://scruss.com/blog/2013/05/12/clean-up-your-gnupg-keyring/
# my key should probably be the first secret key listed
-mykey=$(gpg --list-secret-keys | grep '^sec' | cut -c 13-20 | head -1)
+mykey=$(gpg --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5 | head -1)
if
[ -z $mykey ]
then
@@ -14,7 +14,7 @@ then
fi
# all of the people who have signed my key
-mysigners=$(gpg --list-sigs $mykey | grep '^sig' | cut -c 14-21 | sort -u)
+mysigners=$(gpg --list-sigs --with-colons $mykey | grep '^sig' | cut -d: -f5 | sort -u)
# keep all of the signers, plus my key (if I haven't self-signed)
keepers=$(echo $mykey $mysigners | tr ' ' '\012' | sort -u)
@@ -26,7 +26,7 @@ keepers_egrep=$(echo $keepers | sed 's/^/^(/; s/$/)/; s/ /|/g;')
echo '# Keepers: ' $keepers
# everyone who isn't on the keepers list is deleted
-deleters=$(gpg --list-keys | grep '^pub'| cut -c 13-20 | egrep -v ${keepers_egrep})
+deleters=$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5 | egrep -v ${keepers_egrep})
# echo the command if there are any to delete
# command is interactive