33 lines
744 B
Bash
Executable File
33 lines
744 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Set MAILADDRESS variable
|
|
read -p 'Type in your chaospott mail address: ' MAILADDRESS
|
|
|
|
# Get WKDHASH
|
|
WKDHASH=$(gpg --with-wkd-hash --fingerprint "$MAILADDRESS" | egrep "[ ]{,14}[0-9a-z]{32}@chaospott\.de" | head -n1 | sed 's/ //g;s/@chaospott\.de//')
|
|
|
|
if [ -n "$WKDHASH" ]; then
|
|
# Export key into WKDHASH
|
|
gpg --no-armor --export "$MAILADDRESS" > "$WKDHASH"
|
|
git add "$WKDHASH"
|
|
|
|
# git commit and push
|
|
read -p 'Enter your nickname: ' NICKNAME
|
|
git commit -m "$NICKNAME"
|
|
COMMITEXIT=$?
|
|
git push
|
|
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
|
|
else
|
|
echo "Mail address is not in your keyring."
|
|
exit 1
|
|
fi
|