aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/append
blob: ccb25fbe70db850274ecbee7a7c3ac53e52835a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
#
# Append information into encrypted files.
#

# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" readwrite $* || exit 1

# Get file
keyringer_get_file "$2"

# Only display directions if we're running append, not append-batch
if [ "$BASENAME" == "append" ]; then
  printf "Please write the content to be appended on %s, finnishing with Ctrl-D:\n" "$FILE"
fi

# Append content to an existing secret
( keyringer_exec decrypt "$BASEDIR" "$FILE" && cat ) | \
  keyringer_exec encrypt-batch "$BASEDIR" "$FILE"