wkd/genwkdkey

35 lines
778 B
Plaintext
Raw Permalink Normal View History

2022-06-15 20:34:02 +00:00
#!/bin/bash
2022-06-16 12:35:40 +00:00
# Set MAILADDRESS variable
2022-06-15 20:34:02 +00:00
read -p 'Type in your chaospott mail address: ' MAILADDRESS
2022-06-16 12:35:40 +00:00
# Get WKDHASH
2022-07-02 14:01:35 +00:00
WKDHASHES=$(gpg --with-wkd-hash --fingerprint "$MAILADDRESS" | egrep "[ ]+[0-9a-z]{32}@chaospott\.de" | sed 's/ //g;s/@chaospott\.de//')
2022-06-15 20:34:02 +00:00
2022-07-02 14:01:35 +00:00
if [ -n "$WKDHASHES" ]; then
for wkdhash in $WKDHASHES; do
# Export key into WKDHASH
gpg --no-armor --export "$MAILADDRESS" > "$wkdhash"
git add "$wkdhash"
done
2022-06-16 12:35:40 +00:00
# git commit and push
2022-06-16 13:04:24 +00:00
read -p 'Enter your nickname: ' NICKNAME
git commit -m "$NICKNAME"
COMMITEXIT=$?
2022-06-15 20:34:02 +00:00
git push
2022-06-16 13:04:24 +00:00
if [ $? -ne 0 ]; then
if [ $COMMITEXIT -eq 0 ]; then
git reset HEAD~1
fi
echo "git push failed. Try again."
exit 1
fi
exit 0
2022-06-15 20:34:02 +00:00
else
echo "Mail address is not in your keyring."
2022-06-16 13:04:24 +00:00
exit 1
2022-06-15 20:34:02 +00:00
fi