From c03461f7ee7308d89b45c495c85512362e36433b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 14 Mar 2014 10:28:09 -0300 Subject: Check if keyring exists --- keyringer | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'keyringer') diff --git a/keyringer b/keyringer index 0930637..e57dfd0 100755 --- a/keyringer +++ b/keyringer @@ -161,6 +161,12 @@ fi # Load functions source "$LIB" || exit 1 +# Check if keyring exist +if [ ! -f "$CONFIG_BASE/$KEYRING" ]; then + echo "No such keyring $KEYRING" + exit 1 +fi + # Setup main configuration and load preferences keyringer_config_load -- cgit v1.2.3 From 301b02acc4d165548d8209dd5b5e2f214dcde765 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 14 Mar 2014 10:33:33 -0300 Subject: Always use keyringer_exec / init action check --- keyringer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyringer') diff --git a/keyringer b/keyringer index e57dfd0..da87678 100755 --- a/keyringer +++ b/keyringer @@ -97,7 +97,7 @@ function keyringer_init { echo "Now you have to edit the default recipient configuration to be able to encrypt secrets." echo "Press any key to proceed editing..." read key - keyringer $KEYRING recipients edit default + keyringer_exec recipients "$BASEDIR" edit default # Stage and commit keyringer_exec git "$BASEDIR" add . @@ -162,7 +162,7 @@ fi source "$LIB" || exit 1 # Check if keyring exist -if [ ! -f "$CONFIG_BASE/$KEYRING" ]; then +if [ ! -f "$CONFIG_BASE/$KEYRING" ] && [ "$ACTION" != "init" ]; then echo "No such keyring $KEYRING" exit 1 fi -- cgit v1.2.3 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(-) (limited to 'keyringer') 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 From 3f7f4aa86309ebc44e1097158ec33abda3465945 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 14 Mar 2014 10:55:19 -0300 Subject: Basic checks --- keyringer | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'keyringer') diff --git a/keyringer b/keyringer index 161ab5e..0ec90be 100755 --- a/keyringer +++ b/keyringer @@ -177,8 +177,11 @@ fi # Load functions source "$LIB" || exit 1 -# Check if keyring exists -if [ ! -f "$CONFIG_BASE/$KEYRING" ] && [ "$ACTION" != "init" ]; then +# Basic checks +if [ -z "$KEYRING" ]; then + keyringer_usage + exit 1 +elif [ ! -f "$CONFIG_BASE/$KEYRING" ] && [ "$ACTION" != "init" ]; then echo "No such keyring $KEYRING" exit 1 fi @@ -187,10 +190,7 @@ fi keyringer_config_load # Dispatch -if [ -z "$KEYRING" ]; then - keyringer_usage - exit 1 -elif [ -z "$ACTION" ]; then +if [ -z "$ACTION" ]; then # Run shell if no action were given keyringer $KEYRING shell elif [ "$ACTION" == "init" ]; then -- cgit v1.2.3 From 86835f829aacd8466e1fbc908b77de75d722423d Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 14 Mar 2014 13:22:36 -0300 Subject: Use --include at git config --- keyringer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyringer') diff --git a/keyringer b/keyringer index 0ec90be..a8dd5c7 100755 --- a/keyringer +++ b/keyringer @@ -40,8 +40,8 @@ function keyringer_init { 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." + if [ -z "`git config --global --includes --get user.name`" ] || [ -z "`git config --global --includes --get user.email`" ]; then + echo "No git config found, so please chose a name and email address to identify your changes in the new keyring repository." read -p "Enter your desired name/pseudonym: " name read -p "Enter your desired email address: " email -- cgit v1.2.3 From 38c1700e6e21d070c39e0e64127995b3246d7460 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 14 Mar 2014 13:25:47 -0300 Subject: Keyringer 0.3.1 --- ChangeLog | 2 +- keyringer | 2 +- share/man/keyringer.1 | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'keyringer') diff --git a/ChangeLog b/ChangeLog index fd7baca..6730f39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2014-02-25 - Silvio Rhatto +2014-03-14 - 0.3.1 - Silvio Rhatto Try to get an initial recipient (#32) diff --git a/keyringer b/keyringer index a8dd5c7..dd6e828 100755 --- a/keyringer +++ b/keyringer @@ -138,7 +138,7 @@ function keyringer_dispatch { # Config NAME="keyringer" -KEYRINGER_VERSION="0.3" +KEYRINGER_VERSION="0.3.1" CONFIG_VERSION="0.1" CONFIG_BASE="$HOME/.$NAME" CONFIG="$CONFIG_BASE/config" diff --git a/share/man/keyringer.1 b/share/man/keyringer.1 index 8402b9c..9d2eae8 100644 --- a/share/man/keyringer.1 +++ b/share/man/keyringer.1 @@ -70,7 +70,7 @@ Create a directory inside the repository \f[I]keys\f[] folder. .RS .RE .TP -.B :rmdir <\f[I]path\f[]> +.B rmdir <\f[I]path\f[]> Remove an empty folder inside the repository \f[I]keys\f[] folder. .RS .RE @@ -101,6 +101,11 @@ Remove permanently a local copy of a repository, very dangerous if you have just a single copy. .RS .RE +.TP +.B check +Run maintenance checks in a keyring. +.RS +.RE .SH SECRET MANIPULATION ACTIONS .PP All secret manipulation actions operate upon a \f[I]secret\f[] which is -- cgit v1.2.3