aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-09-18 12:49:45 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-09-18 12:49:45 -0300
commitf9e575896519e78788b0bb5cd2eb1f1f4840f88a (patch)
tree826ac7f9b24f6d4cf92d80ed76e9311447e6bf89
parent2aa6f0127bad78d4dc3279f104c4660ee47855a5 (diff)
downloadkeyringer-f9e575896519e78788b0bb5cd2eb1f1f4840f88a.tar.gz
keyringer-f9e575896519e78788b0bb5cd2eb1f1f4840f88a.tar.bz2
Checking for $BASEDIR and $OPTIONS at keyringer_set_env
-rw-r--r--lib/keyringer/functions10
-rwxr-xr-xshare/keyringer/decrypt1
-rwxr-xr-xshare/keyringer/git6
-rwxr-xr-xshare/keyringer/ls6
-rwxr-xr-xshare/keyringer/newkeys3
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index d474666..96ca7e6 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -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
diff --git a/share/keyringer/decrypt b/share/keyringer/decrypt
index 71367f5..1fe0ee3 100755
--- a/share/keyringer/decrypt
+++ b/share/keyringer/decrypt
@@ -11,4 +11,5 @@ keyringer_set_env $*
# Get file
keyringer_get_file $2
+# Decrypt
gpg --quiet --use-agent -d $KEYDIR/$FILE
diff --git a/share/keyringer/git b/share/keyringer/git
index 76437ac..b453a8f 100755
--- a/share/keyringer/git
+++ b/share/keyringer/git
@@ -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
diff --git a/share/keyringer/ls b/share/keyringer/ls
index 2a198e8..81e3177 100755
--- a/share/keyringer/ls
+++ b/share/keyringer/ls
@@ -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
diff --git a/share/keyringer/newkeys b/share/keyringer/newkeys
index 531cf42..c7eb562 100755
--- a/share/keyringer/newkeys
+++ b/share/keyringer/newkeys
@@ -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