]> code.delx.au - monosys/blob - borg/do-install
borg backups
[monosys] / borg / do-install
1 #!/bin/bash
2
3 set -eux
4
5 cd "$(dirname "$0")"
6
7 BORG_PASSPHRASE="$(dd if=/dev/urandom of=/dev/stdout bs=1 count=15 2>/dev/null | base64)"
8
9 install -m 0755 bsnap backup /usr/local/bin/
10 install -m 0644 -T etc-borg-exclude /etc/borg-exclude
11 install -m 0600 -T etc-borg-env /etc/borg-env
12 sed -i "s|SECRET|$BORG_PASSPHRASE|" /etc/borg-env
13
14 install -m 0644 -T etc-cron.d-backup /etc/cron.d/backup
15 H=$((16#$(hostname|md5sum|head -c 1) % 7 + 14))
16 M=$((16#$(hostname|md5sum|head -c 2) % 60))
17 sed -i -e "s|\$H|$H|" -e "s|\$M|$M|" /etc/cron.d/backup
18
19 [ -f /root/.ssh/id_rsa.pub ] || ssh-keygen
20 cat /root/.ssh/id_rsa.pub
21 install -m 0600 -T root-ssh-config /root/.ssh/config