sauvegardes/bin/doinit

29 lines
552 B
Bash
Executable File

#!/bin/bash
help()
{
echo "Usage: doinit [ -h | -help | --help | <COMPUTER> ]"
echo "Init a borg repository."
}
#
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
COMPUTER="$1"
borgmatic -c /etc/borgmatic.d/${COMPUTER}.yaml init --encryption=repokey-blake2
chown -R borg.borg /var/backups/borg/${COMPUTER}.repo
fi