Skip to content

Commit 0d89fb3

Browse files
committed
improve debuggability
1 parent 701db5b commit 0d89fb3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gen-gpg-key.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env bash
22

3+
if [[ -z "$GPG_PASSPHRASE" ]]; then
4+
echo "GPG_PASSPHRASE is not set. Please set it before running this script."
5+
exit 1
6+
fi
7+
38
gpg --batch --gen-key <<EOF
49
Key-Type: 1
510
Key-Length: 2048
@@ -8,7 +13,12 @@ Subkey-Length: 2048
813
Name-Real: zephyrscale
914
Name-Email: tm4j.bot@gmail.com
1015
Expire-Date: 0
11-
Passphrase: ${GPG_PASSPHRASE}
16+
Passphrase: $GPG_PASSPHRASE
1217
EOF
1318

14-
gpg --keyserver hkps://keys.openpgp.org --send-keys $(gpg --with-colons --fingerprint | awk -F: '$1 == "fpr" {print $10;}')
19+
FINGERPRINT=$(gpg --with-colons --fingerprint | awk -F: '$1 == "fpr" {print $10;}')
20+
if [[ -z "$FINGERPRINT" ]]; then
21+
echo "No GPG key fingerprint found. Please check if the key was generated successfully."
22+
exit 1
23+
fi
24+
gpg --keyserver hkps://keys.openpgp.org --send-keys $FINGERPRINT

0 commit comments

Comments
 (0)