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

10 lines
271 B
Bash
Raw Normal View History

2024-03-07 14:25:45 +01:00
#!/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