dns-update/install.sh

23 lines
759 B
Bash
Raw Normal View History

2022-03-13 13:05:35 +01:00
#!/usr/bin/env bash
2022-02-11 20:24:15 +01:00
2022-09-22 18:51:37 +02:00
run_directory=$(dirname $(readlink -f "$0"))
2022-03-17 15:12:13 +01:00
2022-03-17 14:58:19 +01:00
if [ -f $run_directory/.disabled ]; then
echo "Installation is disabled. Exiting..."
exit 0
fi
2022-02-11 20:24:15 +01:00
echo "Copying Systemd units to system directory..."
2022-03-17 15:12:13 +01:00
sudo cp $run_directory/systemd-templates/dns-update.service /etc/systemd/system/
sudo cp $run_directory/systemd-templates/dns-update.timer /etc/systemd/system/
2022-02-11 20:24:15 +01:00
sudo sed -i -e "s/PH_USER/$(whoami)/g" /etc/systemd/system/dns-update.service
2022-08-28 12:41:33 +02:00
sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/dns-update.service
2022-02-11 20:24:15 +01:00
echo "Reloading Systemd..."
sudo systemctl daemon-reload
echo "Enabling timer (not starting it, either do it manually or reboot)"
sudo systemctl enable dns-update.timer
echo "Finished install. Exiting..."
exit 0