blob: 2b3eb27b44488fc3db076851be579a4aac7764ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/bash
#
# Append information into encrypted files.
#
# Load functions
LIB="`dirname $0`/../../lib/keyringer/functions"
source $LIB
keyringer_set_env $*
# Aditional parameters
FILE="`keyringer_filename $2`"
if [ -z "$FILE" ]; then
echo "Usage: keyringer <keyring> `basename $0` <file>"
exit 1
elif [ ! -f "$RECIPIENTS" ]; then
echo "No recipient config was found"
exit 1
elif [ ! -f "$KEYDIR/$FILE" ]; then
echo "File not found: $KEYDIR/$FILE"
exit 1
fi
CONTENT=($(keyringer_exec decrypt $BASEDIR $FILE))
echo "This is the current content of $FILE:"
echo " "
echo "$CONTENT"
echo " "
echo "Now please write the content to be appended on $FILE, finnishing with Ctrl-D:"
APPEND=($(cat -))
NEW=( ${CONTENT[@]} ${APPEND[@]} )
for element in $(seq 0 $((${#NEW[@]} - 1))); do
echo ${NEW[$element]}
done | keyringer_exec encrypt $BASEDIR $FILE
|