diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:25:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:25:47 +0000 |
commit | 4ed1a6e1d4fcb1ba272a4fb3931b33d1c6fbee0d (patch) | |
tree | 26048107dbe7d72d60d9339d90f5cfe678937863 /scripts/explode-keyring | |
parent | Initial commit. (diff) | |
download | debian-keyring-4ed1a6e1d4fcb1ba272a4fb3931b33d1c6fbee0d.tar.xz debian-keyring-4ed1a6e1d4fcb1ba272a4fb3931b33d1c6fbee0d.zip |
Adding upstream version 2023.12.24.upstream/2023.12.24
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/explode-keyring')
-rwxr-xr-x | scripts/explode-keyring | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/explode-keyring b/scripts/explode-keyring new file mode 100755 index 0000000..d6362ac --- /dev/null +++ b/scripts/explode-keyring @@ -0,0 +1,38 @@ +#!/bin/sh + +# Copyright (c) 2008 Jonathan McDowell <noodles@earth.li> +# GNU GPL; v2 or later +# Converts a keyring into individual keys. +# Taken from jetring-explode, Copyright 2007 Joey Hess <joeyh@debian.org> + +set -e + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Usage: explode-keyring keyring dir" >&2 + exit 1 +fi + +# avoid gnupg touching ~/.gnupg +GNUPGHOME=$(mktemp -d -t jetring.XXXXXXXX) +export GNUPGHOME +trap cleanup exit +cleanup () { + rm -rf "$GNUPGHOME" +} + +keyring=$(readlink -f "$1") # gpg works better with absolute keyring paths +changesetdir="$2" + +basename=$(basename "$keyring") +date=`date -R` + +mkdir -p "$changesetdir" + +for key in $(gpg --no-auto-check-trustdb --options /dev/null --no-default-keyring --keyring "$keyring" --list-keys --keyid-format long | grep '^pub' | sed -e 's!.*/!!' -e 's/ .*//'); do + out="$changesetdir/0x$key" + echo "$out" + gpg --no-auto-check-trustdb --options /dev/null \ + --no-default-keyring --keyring "$keyring" \ + --export-options no-export-attributes \ + --export "$key" > "$out" +done |