summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2014-09-18 12:25:50 +0200
committerPeter Palfrader <peter@palfrader.org>2014-09-18 12:25:50 +0200
commitadbffb5a4c01979e3d218052c8a21050c666e492 (patch)
tree3610c8d1f604df5f44fabff6d38ffc9e5d73746e
parent374ebd7be96fc92fb8805a6e64d0ca7c31e814fb (diff)
Support depth instead of multiple keys in get-signers
-rwxr-xr-xget-signers16
1 files changed, 11 insertions, 5 deletions
diff --git a/get-signers b/get-signers
index 98d5082..d383f41 100755
--- a/get-signers
+++ b/get-signers
@@ -1,11 +1,17 @@
#!/bin/sh
if [ "$#" -eq 0 ]; then
- echo >&2 "Usage: $0 <keyid> [<keyid> ..]"
+ echo >&2 "Usage: $0 <keyid> [ <depth> ]"
exit 1
fi
-gpg --with-colons --fast-list-mode --list-sigs "$@" |
- awk -F ':' '$1 ~ /sig|rev/ {print $5}' |
- sort -u |
- xargs gpg --recv-keys
+keys="$1"
+depth="${2:-1}"
+
+while [ "$depth" -gt 0 ]; do
+
+ keys=$(gpg --with-colons --fast-list-mode --list-sigs $keys | awk -F ':' '$1 ~ /sig|rev/ {print $5}' | sort -u)
+ gpg --recv-keys $keys
+
+ depth=$((depth - 1))
+done