sauvegardes/bin/doinit

29 lines
552 B
Plaintext
Raw Normal View History

2023-01-15 01:10:38 +01:00
#!/bin/bash
help()
{
2023-01-17 14:21:45 +01:00
echo "Usage: doinit [ -h | -help | --help | <COMPUTER> ]"
2023-01-16 19:44:21 +01:00
echo "Init a borg repository."
2023-01-15 01:10:38 +01:00
}
#
help=0
if (( $# != 1)); then
help=1
else
for parameter in $@; do
if [ "$parameter" == "-h" ] || [ "$parameter" == "-help" ] || [ "$parameter" == "--help" ]; then
help=1
fi
done
fi
if (( $help )); then
help
else
2023-01-16 19:44:21 +01:00
COMPUTER="$1"
2023-01-15 01:10:38 +01:00
2023-01-16 19:44:21 +01:00
borgmatic -c /etc/borgmatic.d/${COMPUTER}.yaml init --encryption=repokey-blake2
2023-01-17 16:23:00 +01:00
chown -R borg.borg /var/backups/borg/${COMPUTER}.repo
2023-01-15 01:10:38 +01:00
fi