summaryrefslogtreecommitdiff
path: root/localgpgexpandkeyring
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-03-27 13:34:04 +0200
committerJonas Smedegaard <dr@jones.dk>2017-03-27 13:34:04 +0200
commit78615bd2736fc5cc177db325866e3ff5dc427668 (patch)
tree4269c4cc9c630d84e1ca30eab4aaebf999209578 /localgpgexpandkeyring
parent1b50142ade971bf110e4a30367487c868b4c8676 (diff)
First argument is a key to treat as local.
Diffstat (limited to 'localgpgexpandkeyring')
-rwxr-xr-xlocalgpgexpandkeyring7
1 files changed, 6 insertions, 1 deletions
diff --git a/localgpgexpandkeyring b/localgpgexpandkeyring
index 0e3e027..6df0b0c 100755
--- a/localgpgexpandkeyring
+++ b/localgpgexpandkeyring
@@ -3,11 +3,16 @@
set -e
+if [ $# > 0 ]; then
+ mykeys="$1"
+ shift
+fi
+
# 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 --no-auto-check-trustdb --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5)
+mykeys=${mykeys:-$($GPG --batch --no-auto-check-trustdb --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"