firefox-backup/install.sh

27 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2022-03-14 21:45:57 +01:00
#!/usr/bin/env bash
2022-09-22 18:52:25 +02:00
run_directory=$(dirname $(readlink -f "$0"))
2022-03-14 21:45:57 +01:00
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:$run_directory:g" /etc/systemd/system/firefox-backup-$user.service
2022-03-14 21:45:57 +01:00
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