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

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

# 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"