2023-01-15 01:10:38 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
help()
|
|
|
|
{
|
2023-01-16 19:44:21 +01:00
|
|
|
echo "Usage: doinit [ -h | -help | --help | <MACHINE> ]"
|
|
|
|
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-15 01:10:38 +01:00
|
|
|
fi
|
2023-01-16 19:44:21 +01:00
|
|
|
|
|
|
|
|