2022-03-14 21:45:57 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
run_directory=$(dirname "$0")
|
|
|
|
user=$(whoami)
|
|
|
|
|
2022-03-17 14:59:20 +01:00
|
|
|
if [ -f $run_directory/.disabled ]; then
|
|
|
|
echo "Installation is disabled. Exiting..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2022-03-14 21:45:57 +01:00
|
|
|
echo "Copying Systemd units to system directory..."
|
|
|
|
sudo cp $run_directory/systemd-templates/firefox-backup-.service /etc/systemd/system/firefox-backup-$user.service
|
|
|
|
sudo sed -i -e "s/PH_USER/$user/g" /etc/systemd/system/firefox-backup-$user.service
|
|
|
|
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/firefox-backup-$user.service
|
|
|
|
|
|
|
|
echo "Reloading Systemd..."
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
echo "Enabling service (and starting it so a backup occurs at next shutdown)..."
|
|
|
|
sudo systemctl enable --now firefox-backup-$user.service
|
|
|
|
|
|
|
|
echo "------------------------------------------------------------------------"
|
|
|
|
echo "Make sure you set variables.conf!"
|
|
|
|
echo "If your backup directory is not on root volume, please add a drop-in with Requires=X.mount to /etc/systemd/system/firefox-backup-$user.service."
|
|
|
|
echo "------------------------------------------------------------------------"
|
|
|
|
echo "Finished install. Exiting..."
|
|
|
|
exit 0
|