firefox-backup/install.sh
2022-03-14 21:45:57 +01:00

22 lines
999 B
Bash
Executable File

#!/usr/bin/env bash
run_directory=$(dirname "$0")
user=$(whoami)
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