diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-18 13:27:02 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-18 13:27:02 -0300 |
commit | accf65eda77b9a6c6edffcca825ddbc32e3cc63b (patch) | |
tree | 63fe0a881d27208a7f1f16ae2943036bac18ef1f /share | |
parent | f9e575896519e78788b0bb5cd2eb1f1f4840f88a (diff) | |
download | keyringer-accf65eda77b9a6c6edffcca825ddbc32e3cc63b.tar.gz keyringer-accf65eda77b9a6c6edffcca825ddbc32e3cc63b.tar.bz2 |
Making code that checks for command argument as a common function
Diffstat (limited to 'share')
-rwxr-xr-x | share/keyringer/newkeys | 15 | ||||
-rwxr-xr-x | share/keyringer/options | 9 | ||||
-rwxr-xr-x | share/keyringer/recipients | 9 | ||||
-rwxr-xr-x | share/keyringer/recrypt | 1 |
4 files changed, 8 insertions, 26 deletions
diff --git a/share/keyringer/newkeys b/share/keyringer/newkeys index c7eb562..eff529e 100755 --- a/share/keyringer/newkeys +++ b/share/keyringer/newkeys @@ -3,14 +3,6 @@ # Create keys for new nodes. # -# Load functions -LIB="`dirname $0`/../../lib/keyringer/functions" -source $LIB -keyringer_set_env $* - -# Aditional parameters -COMMAND="$2" - function newkeys_nodes { # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html grep ^node $* | sed -e 's/^node //' | awk -F, '{for(i=1;i<=NF;i++) {print $i}}' | cut -d "'" -f2 @@ -45,11 +37,10 @@ function newkeys_puppet { # Load functions LIB="`dirname $0`/../../lib/keyringer" source $LIB/functions +keyringer_set_env $* -if [ -z "$COMMAND" ]; then - echo "Usage: keyringer <keyring> `basename $0` <command> [arguments]" - exit 1 -fi +# Command parser +keyringer_get_command $2 source $OPTIONS keyringer_config_load_preferences diff --git a/share/keyringer/options b/share/keyringer/options index 4fe8092..6708b54 100755 --- a/share/keyringer/options +++ b/share/keyringer/options @@ -8,13 +8,8 @@ LIB="`dirname $0`/../../lib/keyringer" source $LIB/functions keyringer_set_env $* -# Aditional parameters -COMMAND="$2" - -if [ -z "$COMMAND" ]; then - echo "Usage: keyringer <keyring> `basename $0` <command> [arguments]" - exit 1 -fi +# Command parser +keyringer_get_command $2 # Create options file if old repository if [ ! -e "$OPTIONS" ]; then diff --git a/share/keyringer/recipients b/share/keyringer/recipients index 3410b3d..36eefcc 100755 --- a/share/keyringer/recipients +++ b/share/keyringer/recipients @@ -8,13 +8,8 @@ LIB="`dirname $0`/../../lib/keyringer" source $LIB/functions keyringer_set_env $* -# Aditional parameters -COMMAND="$2" - -if [ -z "$COMMAND" ]; then - echo "Usage: keyringer <keyring> `basename $0` <command> [arguments]" - exit 1 -fi +# Command parser +keyringer_get_command $2 if [ "$COMMAND" == "ls" ]; then cat $RECIPIENTS diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt index 92afa99..a45efa1 100755 --- a/share/keyringer/recrypt +++ b/share/keyringer/recrypt @@ -11,4 +11,5 @@ keyringer_set_env $* # Get file keyringer_get_file $2 +# Recrypt gpg --use-agent -d $KEYDIR/$FILE | gpg --use-agent --armor -e -s $(keyringer_recipients $RECIPIENTS) > $KEYDIR/$FILE |