aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-12-10 22:43:14 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-12-10 22:43:14 -0200
commitb4bdeafcf666b6f7a6f3f33e9f4cf1fb0a7cebbf (patch)
tree176150694cc6ab6368087d5486554c73ac809451
parent7aac0eea6ab0690e040ffe2ed2eab4adde8d5ead (diff)
downloadkeyringer-b4bdeafcf666b6f7a6f3f33e9f4cf1fb0a7cebbf.tar.gz
keyringer-b4bdeafcf666b6f7a6f3f33e9f4cf1fb0a7cebbf.tar.bz2
Comments
-rwxr-xr-xlib/keyringer/actions/commands1
-rwxr-xr-xlib/keyringer/actions/edit1
-rwxr-xr-xlib/keyringer/actions/encrypt4
-rwxr-xr-xlib/keyringer/actions/options1
-rwxr-xr-xlib/keyringer/actions/preferences3
-rwxr-xr-xlib/keyringer/actions/recipients1
-rwxr-xr-xlib/keyringer/actions/recrypt2
-rwxr-xr-xlib/keyringer/actions/teardown1
-rwxr-xr-xlib/keyringer/actions/tree2
-rwxr-xr-xlib/keyringer/actions/usage1
10 files changed, 15 insertions, 2 deletions
diff --git a/lib/keyringer/actions/commands b/lib/keyringer/actions/commands
index 2605666..cb49c02 100755
--- a/lib/keyringer/actions/commands
+++ b/lib/keyringer/actions/commands
@@ -7,4 +7,5 @@
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Dispatch
keyringer_show_actions
diff --git a/lib/keyringer/actions/edit b/lib/keyringer/actions/edit
index 9a3e488..5f31aa0 100755
--- a/lib/keyringer/actions/edit
+++ b/lib/keyringer/actions/edit
@@ -24,6 +24,7 @@ keyringer_set_tmpfile $BASENAME.$EXTENSION
# Decrypt the information to the file
$GPG --yes -o "$TMPWORK" --use-agent -d "$KEYDIR/$FILE"
+# Action check
if [ "$BASENAME" == "edit" ]; then
APP="$EDITOR"
elif [ "$BASENAME" == "open" ]; then
diff --git a/lib/keyringer/actions/encrypt b/lib/keyringer/actions/encrypt
index 0a40bc1..e9bf453 100755
--- a/lib/keyringer/actions/encrypt
+++ b/lib/keyringer/actions/encrypt
@@ -106,12 +106,13 @@ else
keyringer_encrypt $FILE $UNENCRYPTED_FILE
fi
+# Check exit status
err="$?"
-
if [ "$err" != "0" ]; then
exit "$err"
fi
+# Wipe information
if [ "$UNENCRYPTED_FILE" != "-" ]; then
echo "Done. PLEASE WIPE the non-encrypted $UNENCRYPTED_FILE."
fi
@@ -121,4 +122,5 @@ if [ -d "$BASEDIR/.git" ]; then
keyringer_exec git "$BASEDIR" add "keys/$FILE"
fi
+# Done
exit "$?"
diff --git a/lib/keyringer/actions/options b/lib/keyringer/actions/options
index 8508aea..3bf0e43 100755
--- a/lib/keyringer/actions/options
+++ b/lib/keyringer/actions/options
@@ -17,6 +17,7 @@ if [ ! -e "$OPTIONS" ]; then
keyringer_exec git "$BASEDIR" add config/options
fi
+# Dispatch
if [ "$COMMAND" == "ls" ]; then
cat "$OPTIONS"
elif [ "$COMMAND" == "edit" ]; then
diff --git a/lib/keyringer/actions/preferences b/lib/keyringer/actions/preferences
index e82848d..f7507a7 100755
--- a/lib/keyringer/actions/preferences
+++ b/lib/keyringer/actions/preferences
@@ -7,8 +7,10 @@
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Options
COMMAND="$2"
+# Syntax check
if [ -z "$COMMAND" ]; then
echo "Usage: keyringer <keyring> preferences <command> [arguments]"
echo "Available commands:"
@@ -24,6 +26,7 @@ if [ ! -e "$PREFERENCES" ]; then
touch "$PREFERENCES"
fi
+# Dispatch
if [ "$COMMAND" == "ls" ]; then
cat "$PREFERENCES"
elif [ "$COMMAND" == "edit" ]; then
diff --git a/lib/keyringer/actions/recipients b/lib/keyringer/actions/recipients
index 7093a6b..4149786 100755
--- a/lib/keyringer/actions/recipients
+++ b/lib/keyringer/actions/recipients
@@ -13,6 +13,7 @@ keyringer_get_command "$2"
# Set recipients file
keyringer_set_new_recipients "$3"
+# Syntax check and dispatcher
if [ "$COMMAND" == "ls" ]; then
if [ ! -z "$3" ]; then
if [ -e "$RECIPIENTS_FILE" ]; then
diff --git a/lib/keyringer/actions/recrypt b/lib/keyringer/actions/recrypt
index 014fef7..696399b 100755
--- a/lib/keyringer/actions/recrypt
+++ b/lib/keyringer/actions/recrypt
@@ -7,6 +7,7 @@
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Recrypt a single secret
function keyringer_recrypt {
# Get file
keyringer_get_file "$1"
@@ -34,6 +35,7 @@ function keyringer_recrypt {
echo "$recrypted" > "$KEYDIR/$FILE"
}
+# Syntax check and dispatcher
if [ ! -z "$2" ]; then
keyringer_recrypt $2
else
diff --git a/lib/keyringer/actions/teardown b/lib/keyringer/actions/teardown
index 3d33da4..64da740 100755
--- a/lib/keyringer/actions/teardown
+++ b/lib/keyringer/actions/teardown
@@ -10,6 +10,7 @@ source "$LIB" || exit 1
# Options
CONFIRM="$2"
+# Confirmation
if [ -z "$CONFIRM" ] || [ "$CONFIRM" != "-y" ]; then
echo "WARNING: about to remove the LOCAL copy of $KEYRING"
echo "WARNING: This will irrevocably destroy $KEYDIR"
diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree
index a2e272d..8f9d7cd 100755
--- a/lib/keyringer/actions/tree
+++ b/lib/keyringer/actions/tree
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# List keys.
+# List keys, tree version.
#
# Thanks http://www.centerkey.com/tree/
diff --git a/lib/keyringer/actions/usage b/lib/keyringer/actions/usage
index e3369cc..2ca7639 100755
--- a/lib/keyringer/actions/usage
+++ b/lib/keyringer/actions/usage
@@ -7,4 +7,5 @@
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Dispatch
keyringer_usage $KEYRING