diff options
Diffstat (limited to 'share/keyringer/append-batch')
-rwxr-xr-x[l---------] | share/keyringer/append-batch | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/share/keyringer/append-batch b/share/keyringer/append-batch index 6b140f7..5570b6e 120000..100755 --- a/share/keyringer/append-batch +++ b/share/keyringer/append-batch @@ -1 +1,35 @@ -append
\ No newline at end of file +#!/bin/bash +# +# Append information into encrypted files. +# + +# Load functions +LIB="`dirname $0`/../../lib/bash/functions" +source "$LIB" || exit 1 + +# Get file +keyringer_get_file "$2" + +OLDIFS="$IFS" +IFS=$'\n' + +CONTENT=($(keyringer_exec decrypt "$BASEDIR" "$FILE")) + +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 + +# FIXME: dkg doesn't know how to check that this does proper escaping +# (2010-11-16) + +APPEND=($(cat -)) + +NEW=( ${CONTENT[@]} ${APPEND[@]} ) + +for element in $(seq 0 $((${#NEW[@]} - 1))); do + echo ${NEW[$element]} +done | keyringer_exec encrypt-batch $BASEDIR $FILE + +IFS="$OLDIFS" |