diff --git a/genwkdkey b/genwkdkey index 7e60e21..6050252 100755 --- a/genwkdkey +++ b/genwkdkey @@ -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