-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.sh
More file actions
executable file
·17 lines (17 loc) · 883 Bytes
/
backup.sh
File metadata and controls
executable file
·17 lines (17 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
set -xe
mkdir -p /config/borgmatic/ /storage/ssh/
[ -e /storage/ssh/id_ed25519 ] || ssh-keygen -t ed25519 -f /storage/ssh/id_ed25519 -N ''
cat /storage/ssh/id_ed25519.pub
[ -e /config/borgmatic/config.yaml ] || autocreate-borg-repo
BORG_NEW_PASSPHRASE="" borgmatic -c /config/borgmatic init --append-only --encryption keyfile-blake2 --storage-quota 2G -v2
export BORG_BASE_DIR=/repo
export HOME=/repo
borgmatic -c /config/borgmatic create
if [ ! -e /repo/keyexport ]; then
mkdir -p /repo/keyexport
cd /repo/keyexport
borg key export $(ls -1 /repo/.config/borg/security/*/location | head -n1 | xargs cat) ${BORGBASE_NAME}.key
borg key export --paper $(ls -1 /repo/.config/borg/security/*/location | head -n1 | xargs cat) ${BORGBASE_NAME}.paperkey
borg key export --qr-html $(ls -1 /repo/.config/borg/security/*/location | head -n1 | xargs cat) ${BORGBASE_NAME}.html
fi