wkd/genwkdkey

33 lines
740 B
Plaintext
Raw 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 13:49:45 +00:00
WKDHASH=$(gpg --with-wkd-hash --fingerprint "$MAILADDRESS" | egrep "[ ]+[0-9a-z]{32}@chaospott\.de" | head -n1 | sed 's/ //g;s/@chaospott\.de//')
2022-06-15 20:34:02 +00:00
if [ -n "$WKDHASH" ]; then
2022-06-16 12:35:40 +00:00
# Export key into WKDHASH
2022-06-15 20:34:02 +00:00
gpg --no-armor --export "$MAILADDRESS" > "$WKDHASH"
git add "$WKDHASH"
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