From c550c85d75ae38b9621147fdca4bf4380d54edda Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 6 Jan 2018 16:17:35 +0100 Subject: [PATCH] Remove hardcoded paths from systemd unit files. Closes #160 on GitHub. --- systemd/Makefile.am | 14 ++++++++++++++ systemd/{tinc.service => tinc.service.in} | 2 +- systemd/{tinc@.service => tinc@.service.in} | 6 +++--- 3 files changed, 18 insertions(+), 4 deletions(-) rename systemd/{tinc.service => tinc.service.in} (92%) rename systemd/{tinc@.service => tinc@.service.in} (73%) 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 -- 2.20.1