diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-11-10 22:44:58 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-11-10 22:44:58 -0200 |
commit | e53aba05b0a18c39b5f75267318694d2073248f2 (patch) | |
tree | 3c96c45eec82fbfd112ff6cbfe09e4a82ef890cb /lib | |
parent | d6ace9471fbeb4c6c57f803d870accd8b11c7d2f (diff) | |
download | keyringer-e53aba05b0a18c39b5f75267318694d2073248f2.tar.gz keyringer-e53aba05b0a18c39b5f75267318694d2073248f2.tar.bz2 |
Changing encrypt syntax, rebuilding manpage
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/keyringer/actions/encrypt | 22 | ||||
-rwxr-xr-x | lib/keyringer/functions | 14 |
2 files changed, 27 insertions, 9 deletions
diff --git a/lib/keyringer/actions/encrypt b/lib/keyringer/actions/encrypt index 6b9c061..d9d8f96 100755 --- a/lib/keyringer/actions/encrypt +++ b/lib/keyringer/actions/encrypt @@ -7,11 +7,27 @@ LIB="`dirname $0`/../functions" source "$LIB" || exit 1 +# Usage +function keyringer_usage_encrypt { + echo "Usage: keyringer <keyring> $BASENAME <secret> [file]" +} + +# Alias for keyringer_usage_encrypt +function keyringer_usage_encrypt_batch { + keyringer_usage_encrypt $* +} + +# Usage +if [ -z "$2" ]; then + keyringer_action_usage + exit 1 +fi + # Aditional parameters if [ ! -z "$3" ]; then - shift 1 + keyringer_get_new_file $2 + shift 2 UNENCRYPTED_FILE="$*" - keyringer_get_new_file $* if [ ! -f "$UNENCRYPTED_FILE" ]; then echo "Error: cannot encrypt $UNENCRYPTED_FILE: file not found." @@ -45,7 +61,7 @@ if [ "$err" != "0" ]; then fi if [ "$UNENCRYPTED_FILE" != "-" ]; then - echo "Now make to wipe the non-encrypted $UNENCRYPTED_FILE." + echo "Done. PLEASE WIPE the non-encrypted $UNENCRYPTED_FILE." fi # Stage diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 67b5122..bf2977d 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -347,14 +347,16 @@ function keyringer_get_new_file { fi # Sanitize and complete file name - FILE="`echo $FILE | sed -e s/[^A-Za-z0-9.\/]/_/g`" - FILE="$(keyringer_filename "$FILE")" + FILE="`echo $FILE | sed -e s/[^A-Za-z0-9.\/\-]/_/g`" - # Warn user about file name change:w - if [ "`basename "$*"`" != "$FILE" ]; then + # Warn user about file name change + if [ "`basename $*`" != "`basename $FILE`" ]; then echo "Sanitizing destination filename to `basename $FILE`" fi - + + # Complete file name + FILE="$(keyringer_filename "$FILE")" + if [ -z "$*" ]; then keyringer_action_usage exit 1 @@ -365,7 +367,7 @@ function keyringer_get_new_file { function keyringer_get_command { # Aditional parameters COMMAND="$1" - + if [ -z "$COMMAND" ]; then keyringer_action_usage command exit 1 |