diff options
author | Jonas Smedegaard <dr@jones.dk> | 2015-08-06 17:25:29 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2015-08-06 17:25:29 +0200 |
commit | 533019cc280a123b2ae9f345583cac0965a20598 (patch) | |
tree | 6be830bd475b866f9deee569a8d364b88fe23b9d /localgpgexpandkeyring | |
parent | b5682f77efa36c18f9c566705eff5a0d1592fa5c (diff) |
Add localgpgexpandkeyring.
Diffstat (limited to 'localgpgexpandkeyring')
-rwxr-xr-x | localgpgexpandkeyring | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/localgpgexpandkeyring b/localgpgexpandkeyring new file mode 100755 index 0000000..9eabf1e --- /dev/null +++ b/localgpgexpandkeyring @@ -0,0 +1,24 @@ +#!/bin/sh +# fetch missing keys signed by local keys + +set -e + +# set e.g. GPG=gpg2 in environment to override binary to use +GPG=${GPG:+gpg} + +# my keys are those with a corresponding secret key +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" + exit 1 +fi + +# all of the people without key locally who have signed my key +mysigners=$(LC_ALL=C $GPG --batch --list-sigs --with-colons $mykeys | grep '^sig.*User ID not found' | cut -d: -f5 | sort -u) + +if [ -z "$mysigners" ]; then + echo "# Nothing to fetch!" +else + $GPG --batch --keyserver-options no-auto-key-retrieve "$@" --recv-keys $mysigners +fi |