From a490a1bf3e668674760cdda4e46f2e472fc3460c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 Sep 2010 14:23:42 -0300 Subject: Code cleanup --- share/keyringer/append | 8 ++------ share/keyringer/decrypt | 5 ++--- share/keyringer/del | 6 ++---- share/keyringer/edit | 8 ++------ share/keyringer/encrypt | 8 ++------ share/keyringer/genpair | 7 ++----- share/keyringer/git | 7 ++++++- share/keyringer/ls | 8 ++++++-- share/keyringer/newkeys | 11 ++++++----- share/keyringer/options | 11 ++++------- share/keyringer/recipients | 10 ++++++---- share/keyringer/recrypt | 7 ++----- 12 files changed, 42 insertions(+), 54 deletions(-) (limited to 'share') diff --git a/share/keyringer/append b/share/keyringer/append index 4422e29..2b3eb27 100755 --- a/share/keyringer/append +++ b/share/keyringer/append @@ -6,14 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -RECIPIENTS="$BASEDIR/config/recipients" -BASENAME="`basename $0`" if [ -z "$FILE" ]; then echo "Usage: keyringer `basename $0` " diff --git a/share/keyringer/decrypt b/share/keyringer/decrypt index ac4e25d..4a3ca8b 100755 --- a/share/keyringer/decrypt +++ b/share/keyringer/decrypt @@ -6,11 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -BASENAME="`basename $0`" if [ -z "$FILE" ]; then echo "Usage: keyringer `basename $0` " diff --git a/share/keyringer/del b/share/keyringer/del index e032b7c..c699394 100755 --- a/share/keyringer/del +++ b/share/keyringer/del @@ -6,12 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -# Config -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -BASENAME="`basename $0`" # Setup if [ -z "$FILE" ]; then diff --git a/share/keyringer/edit b/share/keyringer/edit index b5cc4ae..264c75f 100755 --- a/share/keyringer/edit +++ b/share/keyringer/edit @@ -6,14 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -RECIPIENTS="$BASEDIR/config/recipients" -BASENAME="`basename $0`" if [ -z "$FILE" ]; then echo "Usage: keyringer `basename $0` " diff --git a/share/keyringer/encrypt b/share/keyringer/encrypt index 396ad4d..d1218ae 100755 --- a/share/keyringer/encrypt +++ b/share/keyringer/encrypt @@ -6,14 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -RECIPIENTS="$BASEDIR/config/recipients" -BASENAME="`basename $0`" # Setup if [ -z "$FILE" ]; then diff --git a/share/keyringer/genpair b/share/keyringer/genpair index ee870b1..6de4b4e 100755 --- a/share/keyringer/genpair +++ b/share/keyringer/genpair @@ -113,16 +113,13 @@ function genpair_ssl { # Load functions LIB="`dirname $0`/../../lib/keyringer" source $LIB/functions +keyringer_set_env $* -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" -KEYDIR="$BASEDIR/keys" +# Aditional parameters KEYTYPE="$2" FILE="$3" NODE="$4" OUTFILE="$5" -BASENAME="`basename $0`" CWD="`pwd`" # Verify diff --git a/share/keyringer/git b/share/keyringer/git index 67d4d0f..76437ac 100755 --- a/share/keyringer/git +++ b/share/keyringer/git @@ -3,7 +3,12 @@ # Git wrapper. # -BASEDIR="$1" +# Load functions +LIB="`dirname $0`/../../lib/keyringer/functions" +source $LIB +keyringer_set_env $* + +# Aditional parameters CWD="`pwd`" if [ -z "$BASEDIR" ]; then diff --git a/share/keyringer/ls b/share/keyringer/ls index 418babb..2a198e8 100755 --- a/share/keyringer/ls +++ b/share/keyringer/ls @@ -3,8 +3,12 @@ # List keys. # -BASEDIR="$1" -KEYDIR="$BASEDIR/keys" +# Load functions +LIB="`dirname $0`/../../lib/keyringer/functions" +source $LIB +keyringer_set_env $* + +# Aditional parameters CWD="`pwd`" if [ -z "$KEYDIR" ]; then diff --git a/share/keyringer/newkeys b/share/keyringer/newkeys index 95b052b..531cf42 100755 --- a/share/keyringer/newkeys +++ b/share/keyringer/newkeys @@ -3,12 +3,13 @@ # Create keys for new nodes. # -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" +# Load functions +LIB="`dirname $0`/../../lib/keyringer/functions" +source $LIB +keyringer_set_env $* + +# Aditional parameters COMMAND="$2" -BASENAME="`basename $0`" -OPTIONS="$BASEDIR/config/options" function newkeys_nodes { # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html diff --git a/share/keyringer/options b/share/keyringer/options index 20a9891..4fe8092 100755 --- a/share/keyringer/options +++ b/share/keyringer/options @@ -3,16 +3,13 @@ # Recipient management. # -# Config -ACTIONS="`dirname $0`" -BASEDIR="$1" -COMMAND="$2" -BASENAME="`basename $0`" -OPTIONS="$BASEDIR/config/options" - # Load functions LIB="`dirname $0`/../../lib/keyringer" source $LIB/functions +keyringer_set_env $* + +# Aditional parameters +COMMAND="$2" if [ -z "$COMMAND" ]; then echo "Usage: keyringer `basename $0` [arguments]" diff --git a/share/keyringer/recipients b/share/keyringer/recipients index 46eb969..7048211 100755 --- a/share/keyringer/recipients +++ b/share/keyringer/recipients @@ -3,11 +3,13 @@ # Recipient management. # -# Config -BASEDIR="$1" +# Load functions +LIB="`dirname $0`/../../lib/keyringer" +source $LIB/functions +keyringer_set_env $* + +# Aditional parameters COMMAND="$2" -BASENAME="`basename $0`" -RECIPIENTS="$BASEDIR/config/recipients" if [ -z "$COMMAND" ]; then echo "Usage: keyringer `basename $0` [arguments]" diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt index cfe3534..f0e15a3 100755 --- a/share/keyringer/recrypt +++ b/share/keyringer/recrypt @@ -6,13 +6,10 @@ # Load functions LIB="`dirname $0`/../../lib/keyringer/functions" source $LIB +keyringer_set_env $* -# Config -BASEDIR="$1" +# Aditional parameters FILE="`keyringer_filename $2`" -KEYDIR="$BASEDIR/keys" -RECIPIENTS="$BASEDIR/config/recipients" -BASENAME="`basename $0`" if [ -z "$FILE" ]; then echo "Usage: keyringer `basename $0` " -- cgit v1.2.3