head was missing; catching errors

This commit is contained in:
Bandie 2022-06-16 15:04:24 +02:00
parent 937496d79f
commit af851c45b5
Signed by: Bandie
GPG Key ID: 7FA4FD7D1D7997C2

View File

@ -4,7 +4,7 @@
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" | sed 's/ //g;s/@chaospott\.de//')
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
@ -12,10 +12,21 @@ if [ -n "$WKDHASH" ]; then
git add "$WKDHASH"
# git commit and push
echo "OK. Now put your nickname in the commit message."
read -p 'Press enter.'
git commit
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