diff options
author | Peter Palfrader <peter@palfrader.org> | 2015-11-04 10:26:23 +0100 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2016-01-07 15:46:29 +0100 |
commit | e59cfa5a9891e6d6a0461948971100ee245fb173 (patch) | |
tree | 997cd24bbb86f6c4b186c930609ae8fefb84b320 /get-signers | |
parent | 9325a82d33e943162897ed48e5afab15dce0667d (diff) |
Only download ech key once
Diffstat (limited to 'get-signers')
-rwxr-xr-x | get-signers | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/get-signers b/get-signers index 1831686..e9ea32f 100755 --- a/get-signers +++ b/get-signers @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash usage() { @@ -31,12 +31,22 @@ if [ "$#" -eq 0 ]; then exit 1 fi +tmpdir=`mktemp -d` +trap "rm -rf '$tmpdir'" EXIT + keys="$*" gpg --recv-keys $keys 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 + recv="" + for k in $keys; do + if ! [ -e "$tmpdir/$k" ]; then + recv="$recv $k" + touch "$tmpdir/$k" + fi + done + + gpg --recv-keys $recv depth=$((depth - 1)) done |