]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Checking for $BASEDIR and $OPTIONS at keyringer_set_env
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Sep 2010 15:49:45 +0000 (12:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Sep 2010 15:49:45 +0000 (12:49 -0300)
lib/keyringer/functions
share/keyringer/decrypt
share/keyringer/git
share/keyringer/ls
share/keyringer/newkeys

index d474666f9d1f8cab15cd1d2fe18c20f961e7aff0..96ca7e6230cc833f1d58b2824fddff4e3e30b7df 100644 (file)
@@ -171,6 +171,11 @@ function keyringer_set_env {
   RECIPIENTS="$BASEDIR/config/recipients"
   OPTIONS="$BASEDIR/config/options"
 
+  if [ -z "$BASEDIR" ]; then
+    keyringer_action_usage
+    exit 1
+  fi
+
   if [ ! -f "$RECIPIENTS" ]; then
     echo "No recipient config was found"
     exit 1
@@ -180,6 +185,11 @@ function keyringer_set_env {
     echo "You have to set EDITOR env variable"
     exit 1
   fi
+
+  if [ ! -f "$OPTIONS" ]; then
+    echo "No option config was found"
+    exit 1
+  fi
 }
 
 # Get a single argument
index 71367f54acc15f8404940557be2ea1fff9cbbc0d..1fe0ee30f1a1ac2dd1609b8ed85424b8c1f21750 100755 (executable)
@@ -11,4 +11,5 @@ keyringer_set_env $*
 # Get file
 keyringer_get_file $2
 
+# Decrypt
 gpg --quiet --use-agent -d $KEYDIR/$FILE
index 76437ac13a77a75274b3fc1c30ef206ccccd9101..b453a8f483871cb26cf758836edfdf6d7ff0c03d 100755 (executable)
@@ -11,11 +11,7 @@ keyringer_set_env $*
 # Aditional parameters
 CWD="`pwd`"
 
-if [ -z "$BASEDIR" ]; then
-  echo "Usage: keyringer <keyringer> `basename $0` [arguments]"
-  exit 1
-fi
-
+# Run git command
 shift
 mkdir -p $BASEDIR && cd $BASEDIR && git $*
 cd $CWD
index 2a198e8c11db8451d66d53e87b319e9c3be5dda5..81e3177d5ad426d0812a25fac32eb0bdc642bcec 100755 (executable)
@@ -11,11 +11,7 @@ keyringer_set_env $*
 # Aditional parameters
 CWD="`pwd`"
 
-if [ -z "$KEYDIR" ]; then
-  echo "Usage: keyringer <keyring> `basename $0` [arguments]"
-  exit 1
-fi
-
+# Run list command
 shift
 cd $KEYDIR && ls $*
 cd $CWD
index 531cf427f3b3558251f5761ba1011ffeed184da1..c7eb562fbfa462562755c2b3c8c97cbca19ebfdd 100755 (executable)
@@ -49,9 +49,6 @@ source $LIB/functions
 if [ -z "$COMMAND" ]; then
   echo "Usage: keyringer <keyring> `basename $0` <command> [arguments]"
   exit 1
-elif [ ! -f "$OPTIONS" ]; then
-  echo "No option config was found"
-  exit 1
 fi
 
 source $OPTIONS