23 lines
759 B
Bash
Executable File
23 lines
759 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
run_directory=$(dirname $(readlink -f "$0"))
|
|
|
|
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/dns-update.service /etc/systemd/system/
|
|
sudo cp $run_directory/systemd-templates/dns-update.timer /etc/systemd/system/
|
|
sudo sed -i -e "s/PH_USER/$(whoami)/g" /etc/systemd/system/dns-update.service
|
|
sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/dns-update.service
|
|
|
|
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
|