GPG key mandatory
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 7 Jun 2015 14:56:01 +0000 (10:56 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 7 Jun 2015 14:56:01 +0000 (10:56 -0400)
    * contrib/git-for-steve.sh: Check for gpg installed and make it
      mandatory.  Also when the signing key is not set provide an
      educated guess.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
contrib/git-for-steve.sh

index 8ed2a00..378e39a 100755 (executable)
@@ -46,11 +46,18 @@ if [ -z "$USER_NAME" ]; then
 fi
 git branch --track for-steve origin/master
 git checkout for-steve
+if ! type gpg > dev/null 2>&1 ; then
+    echo "MANDATORY: Please install gpg and create/install your private key."
+    exit 1
+fi
 echo ""
 SIGNKEY=$(git config user.signingkey)
 if [ -z "$SIGNKEY" ]; then
-    echo "OPTIONAL: You might wish to setup your GPG signing key:"
-    echo "    git config user.signingkey <GPG key signature>"
+    KEYGUESS=$(gpg --list-keys $USER_EMAIL |\
+               awk '/^pub/ { split($2,k,"/"); print k[2] }')
+    echo "You need to setup your GPG signing key:"
+    echo "    git config user.signingkey ${KEYGUESS:-<GPG key signature>}"
+    exit 1
 fi
 CO_ALIAS=$(git config alias.co)
 if [ -z "$CO_ALIAS" ]; then