blob: 30c2d5bce1f43a2c19aa7ff9c1fff7ad56bc474c (
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
40
41
|
#!/bin/bash
#
# Append information into encrypted files.
#
# Load functions
LIB="`dirname $0`/../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
err="$?"
if [ "$err" != "0" ]; then
exit "$err"
fi
IFS="$OLDIFS"
|