summaryrefslogtreecommitdiff
path: root/get-signers
blob: 1831686bab397326b9b10683dfdb9c61761e313f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

usage()
{
cat << EOF
Usage: $0 [-d <depth>] <keyid> [ <keyid> .. ]
EOF
}

depth="1"
while getopts "hd:" OPTION
do
    case $OPTION in
        h)
            usage
            exit
            ;;
        d)
            depth="$OPTARG"
            ;;
        *)
            usage >&2
            exit 1
            ;;
    esac
done
shift $(($OPTIND - 1))

if [ "$#" -eq 0 ]; then
  usage >&2
  exit 1
fi

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

  depth=$((depth - 1))
done