[Git][reproducible-builds/reproducible-misc][master] 2 commits: dump-gpg-keys: accept keys from the command line
Mattia Rizzolo
gitlab at salsa.debian.org
Fri Dec 11 16:00:54 UTC 2020
Mattia Rizzolo pushed to branch master at Reproducible Builds / reproducible-misc
Commits:
0e2a9a21 by Mattia Rizzolo at 2020-12-11T16:54:25+01:00
dump-gpg-keys: accept keys from the command line
Thanks Unit193 for the initial patch
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1795ea7f by Mattia Rizzolo at 2020-12-11T17:00:39+01:00
dump-gpg-keys: also accept key files from as script arguments
Thanks Unit193 for the initial patch
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1 changed file:
- dump-gpg-keys.sh
Changes:
=====================================
dump-gpg-keys.sh
=====================================
@@ -14,10 +14,14 @@ trap removetemp EXIT
GPG=("gpg" "--homedir" "$gpghome" "--batch")
-keys=(
- C2FE4BD271C139B86C533E461E953E27D4311E58 # lamby at debian.org
- 66AE2B4AFCCF3F52DA184D184B043FCDB9444540 # mattia at debian.org
-)
+if [ $# -gt 0 ]; then
+ keys=("$@")
+else
+ keys=(
+ C2FE4BD271C139B86C533E461E953E27D4311E58 # lamby at debian.org
+ 66AE2B4AFCCF3F52DA184D184B043FCDB9444540 # mattia at debian.org
+ )
+fi
# import all the keys
# run over multiple keyservers, so to make sure to pick up the latests updated
@@ -27,13 +31,23 @@ keyservers=(
keys.openpgp.org
)
-for _k in "${keyservers[@]}"; do
- "${GPG[@]}" \
- --keyserver "${_k}" \
- --recv-keys \
- "${keys[@]}" || echo "W: $_k returned no useful data, continuing…" >&2
+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
+ for _k in "${keyservers[@]}"; do
+ "${GPG[@]}" \
+ --keyserver "${_k}" \
+ "$action" \
+ "$key" || echo "W: $_k returned no useful data for $key, continuing…" >&2
+ done
done
+
if [ -z "$("${GPG[@]}" -k 2>/dev/null)" ]; then
echo "E: None of the wanted keys was found in any keyserver." >&2
exit 1
@@ -53,4 +67,4 @@ fi
--export \
--armor \
--export-options export-clean,export-minimal \
- "${keys[@]}"
+ "${keyIDs[@]}"
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-misc/-/compare/230891c528ee20dfd8f996d677c7242fa766a3e9...1795ea7feef3d83420cc48e1a74a34e4004e050a
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-misc/-/compare/230891c528ee20dfd8f996d677c7242fa766a3e9...1795ea7feef3d83420cc48e1a74a34e4004e050a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20201211/01acb78a/attachment.htm>
More information about the rb-commits
mailing list