From 15fbe5a432a361cc9c7a628aaae7c041263d3086 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 14 Mar 2014 10:53:09 -0300 Subject: Check git configuration --- keyringer | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/keyringer b/keyringer index da87678..161ab5e 100755 --- a/keyringer +++ b/keyringer @@ -39,6 +39,18 @@ function keyringer_init { exit 1 fi + # Check user configuration: git might complain if those aren't set + if [ -z "`git config --global --get user.name`" ] || [ -z "`git config --global --get user.email`" ]; then + echo "Please chose the name and email address that should identify your changes in the new keyring." + read -p "Enter your desired name/pseudonym: " name + read -p "Enter your desired email address: " email + + if [ -z "$name" ] || [ -z "$email" ]; then + echo "Aborting." + exit 1 + fi + fi + # Setup if [ ! -z "$URL" ]; then git clone "$URL" "$BASEDIR" @@ -93,6 +105,10 @@ function keyringer_init { keyringer_exec git "$BASEDIR" init keyringer_git_ignore 'tmp/*' + # Git configuration + git config user.email "$email" + git config user.name "$name" + # Edit default recipients echo "Now you have to edit the default recipient configuration to be able to encrypt secrets." echo "Press any key to proceed editing..." @@ -161,7 +177,7 @@ fi # Load functions source "$LIB" || exit 1 -# Check if keyring exist +# Check if keyring exists if [ ! -f "$CONFIG_BASE/$KEYRING" ] && [ "$ACTION" != "init" ]; then echo "No such keyring $KEYRING" exit 1 -- cgit v1.2.3