summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-05-17 09:31:06 +0200
committerErich Eckner <git@eckner.net>2016-05-17 09:31:06 +0200
commit379024f6b7bc81625e3163fbd0c5e75b08df3241 (patch)
treeb251b1642faf635ead7e29d76e97789e02cf67c3
parent2a3db303471e7c0674a8a11207a78e5a825a955b (diff)
downloadkernelKeys-379024f6b7bc81625e3163fbd0c5e75b08df3241.tar.xz
sollte erst mal gehen
-rwxr-xr-xdownload-missing-kernel-keys35
1 files changed, 28 insertions, 7 deletions
diff --git a/download-missing-kernel-keys b/download-missing-kernel-keys
index 209a754..c0e5ae0 100755
--- a/download-missing-kernel-keys
+++ b/download-missing-kernel-keys
@@ -1,15 +1,36 @@
#!/bin/bash
-signatures="$( \
+if [ $# -eq 1 ] && [[ "$1" == *".kernel.org/"* ]]
+then
+ curl "$1" | \
+ gpg --verify - "$0" 2>&1 | \
+ grep '^gpg: Signature made .* using \S\+ key ID [0-9A-F]\+$' | \
+ sed 's|^gpg: Signature made .* using \S\+ key ID \([0-9A-F]\+\)$|0x\1|'
+ exit 0
+fi
+
+[ $# -eq 1 ] && lvl=$1 || lvl=2
+
+signatures="$(
curl 'https://kernel.org/' 2>/dev/null | \
tr '"' '\n' | \
- grep '\.sign$' | \
- head -n1
+ grep '\.sign$'
)"
-for s in ${signatures}
-do
- curl "$s" 2> /dev/null | \
- gpg --verify - "$0"
+keyIds=$(
+ echo "${signatures}" | \
+ parallel -j0 "$0" "{}" \; 2> /dev/null | \
+ sort -u
+)
+for ((i=0; i<$lvl; i++))
+do
+ keyIds=$(
+ gpg --list-sigs ${keyIds} | \
+ grep '^sig\s' | \
+ sed 's|^sig\s.\{8\}\s\([0-9A-F]\{8\}\)\s.*$|0x\1|' | \
+ sort -u
+ )
+ echo "${keyIds}" | \
+ xargs -n50 gpg --recv-keys
done