]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Code cleanup
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Sep 2010 17:23:42 +0000 (14:23 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Sep 2010 17:23:42 +0000 (14:23 -0300)
13 files changed:
lib/keyringer/functions
share/keyringer/append
share/keyringer/decrypt
share/keyringer/del
share/keyringer/edit
share/keyringer/encrypt
share/keyringer/genpair
share/keyringer/git
share/keyringer/ls
share/keyringer/newkeys
share/keyringer/options
share/keyringer/recipients
share/keyringer/recrypt

index 22f16f85fecf88e2c32fe4ce1bf8dbc46523d806..7545a52f229467d6f297c3a428a283a2c923106d 100644 (file)
@@ -156,3 +156,18 @@ function keyringer_git_ignore {
     fi
   fi
 }
+
+# Set needed environment variables.
+function keyringer_set_env {
+  if [ -z "$1" ]; then
+    echo "Error: missing arguments for keyringer_set_env"
+    exit 1    
+  fi
+
+  ACTIONS="`dirname $0`"
+  BASENAME="`basename $0`"
+  BASEDIR="$1"
+  KEYDIR="$BASEDIR/keys"
+  RECIPIENTS="$BASEDIR/config/recipients"
+  OPTIONS="$BASEDIR/config/options"
+}
index 4422e29b0c25e2374d21c64155376b41f7d3ed1d..2b3eb27b44488fc3db076851be579a4aac7764ec 100755 (executable)
@@ -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 <keyring> `basename $0` <file>"
index ac4e25d955155b63f1c23608054e5dec707c3f77..4a3ca8b584b3ebad12d4abf757395b6e8d9d973c 100755 (executable)
@@ -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 <keyring> `basename $0` <file>"
index e032b7c69dc1086166f3238ed2aadd692de49f8a..c6993949cb0a68c88d1f139a4f257cc047e4b3c0 100755 (executable)
@@ -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
index b5cc4ae9cd355f2a157dfbdda28555b6e7231d02..264c75f8d1819fab6bbcae753aa31193d9b46c10 100755 (executable)
@@ -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 <keyring> `basename $0` <file>"
index 396ad4d497cbd06a3d5f7d30b754879299e0e9ca..d1218ae2942e9334f0d5b6d2c34a44d18109c8ee 100755 (executable)
@@ -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
index ee870b11f4d6bfbf083d1a003fbbba9d2c01d2d1..6de4b4e461563bbc4604096428bf108e536b41e3 100755 (executable)
@@ -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
index 67d4d0f31fb5cd83aa89d88783f2e47053fb28fb..76437ac13a77a75274b3fc1c30ef206ccccd9101 100755 (executable)
@@ -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
index 418babb80fdb097bb4fc4e08b65d96d7cc628669..2a198e8c11db8451d66d53e87b319e9c3be5dda5 100755 (executable)
@@ -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
index 95b052bf53bdc3be6a7c30695d1e30cd7a310e54..531cf427f3b3558251f5761ba1011ffeed184da1 100755 (executable)
@@ -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
index 20a98915c467520f04b488d1355cb61f6f941658..4fe80924f9529a360f68e2ce0c3423469503c357 100755 (executable)
@@ -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 <keyring> `basename $0` <command> [arguments]"
index 46eb9692281cd790feb35b921300039bc981ee41..7048211fe9367dbf79129600560513f526c39e6b 100755 (executable)
@@ -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 <keyring> `basename $0` <command> [arguments]"
index cfe3534a596439a80dd41fe0056762482d319551..f0e15a315f942a2dcf431cf475f77960e15f83ab 100755 (executable)
@@ -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 <keyring> `basename $0` <file>"