summaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/append
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-11-26 17:18:56 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-11-26 17:18:56 -0200
commit5f1590e0722ee5ee9fed2ccc43adfb88f00218fd (patch)
tree80701dcf0437f4134ca1c15ea1ff7bba72a10230 /lib/keyringer/actions/append
parenta706c54574b389c3e2f74ff487b1b7ca42483dc3 (diff)
parent0358ba548d9d3aaaeb23984e092318522238bca9 (diff)
downloadkeyringer-5f1590e0722ee5ee9fed2ccc43adfb88f00218fd.tar.gz
keyringer-5f1590e0722ee5ee9fed2ccc43adfb88f00218fd.tar.bz2
Imported Upstream version 0.2.9upstream_keyringer_0.2.9
Diffstat (limited to 'lib/keyringer/actions/append')
-rwxr-xr-xlib/keyringer/actions/append28
1 files changed, 5 insertions, 23 deletions
diff --git a/lib/keyringer/actions/append b/lib/keyringer/actions/append
index e945bff..e307056 100755
--- a/lib/keyringer/actions/append
+++ b/lib/keyringer/actions/append
@@ -10,29 +10,11 @@ source "$LIB" || exit 1
# Get file
keyringer_get_file "$2"
-OLDIFS="$IFS"
-IFS=$'\n'
-
-CONTENT=($(keyringer_exec decrypt "$BASEDIR" "$FILE"))
-
+# Only display directions if we're running append, not append-batch
if [ "$BASENAME" == "append" ]; then
- # only display directions if we're running append, not append-batch
- printf "\n%s currently has %d lines\n\n" "$FILE" "${#CONTENT[@]}"
- printf "Now please write the content to be appended on %s, finnishing with Ctrl-D:\n" "$FILE"
-fi
-
-APPEND=($(cat -))
-
-NEW=( ${CONTENT[@]} ${APPEND[@]} )
-
-for element in $(seq 0 $((${#NEW[@]} - 1))); do
- echo ${NEW[$element]}
-done | keyringer_exec encrypt-batch $BASEDIR $FILE
-
-err="$?"
-
-if [ "$err" != "0" ]; then
- exit "$err"
+ printf "Please write the content to be appended on %s, finnishing with Ctrl-D:\n" "$FILE"
fi
-IFS="$OLDIFS"
+# Append content to an existing secret
+( keyringer_exec decrypt "$BASEDIR" "$FILE" && cat ) | \
+ keyringer_exec encrypt-batch $BASEDIR $FILE