borgwrapper/install

37 lines
1.0 KiB
Bash
Executable File

#! /bin/bash
cp -i ./src/borgwrapper /usr/local/bin/borgwrapper
chown root. /usr/local/bin/borgwrapper
chmod 750 /usr/local/bin/borgwrapper
if [ ! -d /etc/borgwrapper/ ]; then
mkdir /etc/borgwrapper
fi
if [ ! -e ./config ]; then
echo "Please rename \"config.example\" to \"config\""
echo "And make sure to update with your settings before running \"install\" again!"
exit 1
fi
cp -i ./config /etc/borgwrapper/config
chown root. /etc/borgwrapper/config
chmod 600 /etc/borgwrapper/config
cp ./systemd/*.{timer,service} /etc/systemd/system/
for config_file in /etc/borgwrapper/*
do
config_file=$(basename ${config_file})
systemctl enable borgwrapper-backup@"${config_file}".timer
systemctl enable borgwrapper-verify@"${config_file}".timer
systemctl start borgwrapper-backup@"${config_file}".timer
systemctl start borgwrapper-verify@"${config_file}".timer
done
echo
echo "Please edit \"/etc/borgwrapper/config\" to make changes to configuration."
echo "Read \"README.md\" for more information."
echo