summaryrefslogtreecommitdiff
path: root/ansible/roles/holywood2/files/run-borg
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/holywood2/files/run-borg')
-rwxr-xr-xansible/roles/holywood2/files/run-borg22
1 files changed, 22 insertions, 0 deletions
diff --git a/ansible/roles/holywood2/files/run-borg b/ansible/roles/holywood2/files/run-borg
new file mode 100755
index 0000000..7225a94
--- /dev/null
+++ b/ansible/roles/holywood2/files/run-borg
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -eu
+
+hostname="$(hostname)"
+target="$1"
+export targetdir="$2"
+shift 2
+
+export BORG_REPO="$target:$targetdir"
+export BORG_PASSCOMMAND="cat /etc/borg-passphrase"
+
+if borg init --encryption=repokey
+then
+ borg upgrade --disable-tam
+fi
+
+DATE="$(date +%Y-%m-%dT%H%M%S)"
+
+echo borg "$@"
+borg "$@"
+echo borg finished