From: Guus Sliepen Date: Sat, 6 Jan 2018 15:17:35 +0000 (+0100) Subject: Remove hardcoded paths from systemd unit files. X-Git-Tag: release-1.1pre16~43 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=c550c85d75ae38b9621147fdca4bf4380d54edda;p=tinc Remove hardcoded paths from systemd unit files. Closes #160 on GitHub. --- diff --git a/systemd/Makefile.am b/systemd/Makefile.am index a1bfe124..b350847a 100644 --- a/systemd/Makefile.am +++ b/systemd/Makefile.am @@ -1,4 +1,18 @@ +EXTRA_DIST = tinc.service.in tinc@.service.in + +CLEANFILES = tinc.service tinc@.service + if WITH_SYSTEMD systemddir = @systemd_path@ dist_systemd_DATA = tinc.service tinc@.service endif + +substitute = sed \ + -e s,'@sbindir\@',"$(sbindir)",g \ + -e s,'@sysconfdir\@',"$(sysconfdir)",g + +tinc.service: $(srcdir)/tinc.service.in + $(AM_V_GEN)$(substitute) $(srcdir)/tinc.service.in > $@ + +tinc@.service: $(srcdir)/tinc@.service.in + $(AM_V_GEN)$(substitute) $(srcdir)/tinc@.service.in > $@ diff --git a/systemd/tinc.service b/systemd/tinc.service.in similarity index 92% rename from systemd/tinc.service rename to systemd/tinc.service.in index d911fa78..b6710424 100644 --- a/systemd/tinc.service +++ b/systemd/tinc.service.in @@ -14,7 +14,7 @@ Type=oneshot RemainAfterExit=yes ExecStart=/bin/true ExecReload=/bin/true -WorkingDirectory=/etc/tinc +WorkingDirectory=@sysconfdir@/tinc [Install] WantedBy=multi-user.target diff --git a/systemd/tinc@.service b/systemd/tinc@.service.in similarity index 73% rename from systemd/tinc@.service rename to systemd/tinc@.service.in index d1f711d4..2d695caa 100644 --- a/systemd/tinc@.service +++ b/systemd/tinc@.service.in @@ -8,9 +8,9 @@ ReloadPropagatedFrom=tinc.service [Service] Type=simple -WorkingDirectory=/etc/tinc/%i -ExecStart=/usr/sbin/tincd -n %i -D -ExecReload=/usr/sbin/tinc -n %i reload +WorkingDirectory=@sysconfdir@/tinc/%i +ExecStart=@sbindir@/tincd -n %i -D +ExecReload=@sbindir@/tinc -n %i reload KillMode=mixed Restart=on-failure RestartSec=5