blob: 28344f49650ac4e2b3ece163b563cb98e2a6dd63 (
plain) (
blame)
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
43
44
45
46
|
#!/bin/bash
# requires: GPG 2.1
# dumps out our minimal keys, useful to create nicely formatted
# debian/upstream/signin-keys.asc in our packages
set -eu -o pipefail
removetemp () { rm -rf "$gpghome" && echo "$gpghome removed" >&2 ; }
gpghome="$(mktemp -d)"
trap removetemp EXIT
GPG=("gpg" "--homedir" "$gpghome" "--batch")
keys=($@)
for key in "${keys[@]}";do
if [ -f "$key" ];then
action="--import"
keyIDs+=($(gpg --with-colons "$key" | cut -d: -f5))
else
action="--recv-keys"
keyIDs+=("$key")
fi
"${GPG[@]}" \
--keyserver keyserver.ubuntu.com \
$action \
"$key"
done
# print some information about the keys
# (--fingerprint twice so the fingeprint of the subkeys is printed too)
"${GPG[@]}" \
--list-keys \
--keyid-format none \
--with-subkey-fingerprint \
--list-options no-show-keyring \
| tail -n +3
# re-export them
"${GPG[@]}" \
--export \
--armor \
--export-options export-minimal \
"${keyIDs[@]}"
|