aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/mk_key.sh45
1 files changed, 26 insertions, 19 deletions
diff --git a/scripts/mk_key.sh b/scripts/mk_key.sh
index 2c98cc8..1e38025 100755
--- a/scripts/mk_key.sh
+++ b/scripts/mk_key.sh
@@ -1,12 +1,22 @@
#!/usr/bin/env sh
+# pgp-wkd - A web key directory for pgp-keys
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: CC-BY-SA-4.0
+#
+# This file is part of pgp-wkd.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt>.
+
die() {
- echo "$@";
- exit 1;
+ echo "$@"
+ exit 1
}
help() {
- cat << EOF
+ cat <<EOF
A helper script to add an gpg key to the wkd.
USAGE:
@@ -30,9 +40,9 @@ EOF
}
add() {
- key_id="$1";
- key_email="$2";
- key_hash="$3";
+ key_id="$1"
+ key_email="$2"
+ key_hash="$3"
cd "$(git rev-parse --show-toplevel)" || die "No source dir!"
@@ -41,26 +51,23 @@ add() {
full_key_id="$(gpg --list-keys --with-colons "$key_id" | awk -F: '/^uid:/ { print $10 }' | tail -n 1)"
mkdir --parents "$dir"
- gpg --no-armor --export "$key_id" > "$dir/$key_hash" &&
-
- printf "%s%s%s%s\n" '`' "$dir/$key_hash" '`' " -> $full_key_id" >> stored_keys.md &&
-
- echo "Key export done!";
+ gpg --no-armor --export "$key_id" >"$dir/$key_hash" &&
+ printf "%s%s%s%s\n" '`' "$dir/$key_hash" '`' " -> $full_key_id" >>stored_keys.md &&
+ echo "Key export done!"
}
for arg in "$@"; do
case "$arg" in
- "--help" | "-h")
- help;
- exit 0;
- ;;
+ "--help" | "-h")
+ help
+ exit 0
+ ;;
esac
done
-
-key_id="$1";
-key_email="$2";
-key_hash="$3";
+key_id="$1"
+key_email="$2"
+key_hash="$3"
shift 3
[ -z "$key_id" ] && die "No KEY_ID specified, see '--help'!"