summaryrefslogtreecommitdiff
path: root/localgpgcleankeyring
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2015-08-06 14:01:02 +0200
committerJonas Smedegaard <dr@jones.dk>2015-08-06 14:45:02 +0200
commitb5682f77efa36c18f9c566705eff5a0d1592fa5c (patch)
treee29b2c80860cd82fe53654ca0f6bdec92c1e8ad2 /localgpgcleankeyring
parent8b1e736274ff56d0a5a73d215ec82ef9a263f5a2 (diff)
Use --batch option, and pass any arguments (e.g. --yes) to final pgp call.
Diffstat (limited to 'localgpgcleankeyring')
-rwxr-xr-xlocalgpgcleankeyring8
1 files changed, 4 insertions, 4 deletions
diff --git a/localgpgcleankeyring b/localgpgcleankeyring
index 7bb5c84..b7fb205 100755
--- a/localgpgcleankeyring
+++ b/localgpgcleankeyring
@@ -6,7 +6,7 @@
set -e
# my keys are those with a corresponding secret key
-mykeys=$(gpg --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5)
+mykeys=$(gpg --batch --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5)
if [ -z "$mykeys" ]; then
# exit if no key string
echo "Can't get user's key ID"
@@ -14,7 +14,7 @@ if [ -z "$mykeys" ]; then
fi
# all of the people who have signed my key
-mysigners=$(gpg --list-sigs --with-colons $mykeys | grep '^sig' | cut -d: -f5 | sort -u)
+mysigners=$(gpg --batch --list-sigs --with-colons $mykeys | grep '^sig' | cut -d: -f5 | sort -u)
# keep all of the signers, plus my key (if I haven't self-signed)
keepers=$(echo $mykeys $mysigners | tr ' ' '\012' | sort -u)
@@ -23,10 +23,10 @@ keepers=$(echo $mykeys $mysigners | tr ' ' '\012' | sort -u)
keepers_egrep=$(echo $keepers | sed 's/^/^(/; s/$/)/; s/ /|/g;')
# everyone who isn't on the keepers list is deleted
-deleters=$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5 | egrep -v ${keepers_egrep})
+deleters=$(gpg --batch --list-keys --with-colons | grep '^pub' | cut -d: -f5 | egrep -v ${keepers_egrep})
if [ -z "$deleters" ]; then
echo "# Nothing to delete!"
else
- gpg --delete-keys $deleters
+ gpg --batch "$@" --delete-keys $deleters
fi