ctucx.git: nixfiles

ctucx' nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
#!/usr/bin/env bash
set -eo pipefail

tempfile=$(mktemp)

trap "rm -f $tempfile" SIGINT SIGTERM ERR EXIT

touch $tempfile
chmod 600 $tempfile

if [ -x "$(which bw)" ]; then
	privkey=$(bw get notes ea70a317-7cac-455e-bee0-7c97d7505a7b)
	if [ $? -ne 0 ]; then exit; fi;
else
	privkey=$(pass agenix-privkey)
	if [ $? -ne 0 ]; then exit; fi;
fi

echo "${privkey}" > $tempfile

cd "`git rev-parse --show-toplevel`/secrets"

agenix -i $tempfile "$@"