#!/usr/bin/env bash run_directory=$(dirname $(readlink -f "$0")) user=$(whoami) if [ -f $run_directory/.disabled ]; then echo "Installation is disabled. Exiting..." exit 0 fi 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 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