dotfiles/crates/90-backups/scripts/setup.sh

10 lines
No EOL
271 B
Bash

#!/bin/sh
HOSTNAME=${HOSTNAME:-$(hostname)}
[ -d "/var/backups" ] || mkdir -p /var/backups
[ -f "/var/backups/$HOSTNAME.secret" ] || openssl rand -hex 64 > /var/backups/$HOSTNAME.secret
restic init \
-r /var/backups/$HOSTNAME \
-p /var/backups/$HOSTNAME.secret