Add run_directory to install.sh

This commit is contained in:
Alexandre CATTEAU 2022-03-17 15:12:13 +01:00
parent 358b934206
commit ec333aabaa

View File

@ -1,13 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
run_directory=$(dirname "$0")
if [ -f $run_directory/.disabled ]; then if [ -f $run_directory/.disabled ]; then
echo "Installation is disabled. Exiting..." echo "Installation is disabled. Exiting..."
exit 0 exit 0
fi fi
echo "Copying Systemd units to system directory..." echo "Copying Systemd units to system directory..."
sudo cp $(dirname "$0")/systemd-templates/dns-update.service /etc/systemd/system/ sudo cp $run_directory/systemd-templates/dns-update.service /etc/systemd/system/
sudo cp $(dirname "$0")/systemd-templates/dns-update.timer /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_USER/$(whoami)/g" /etc/systemd/system/dns-update.service
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/dns-update.service sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/dns-update.service