Closes #160 on GitHub.
+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 > $@
+++ /dev/null
-# This is a mostly empty service, but allows commands like stop, start, reload
-# to propagate to all tinc@ service instances.
-
-[Unit]
-Description=Tinc VPN
-Documentation=info:tinc
-Documentation=man:tinc(8) man:tinc.conf(5)
-Documentation=http://tinc-vpn.org/docs/
-After=network.target
-Wants=network.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/bin/true
-ExecReload=/bin/true
-WorkingDirectory=/etc/tinc
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+# This is a mostly empty service, but allows commands like stop, start, reload
+# to propagate to all tinc@ service instances.
+
+[Unit]
+Description=Tinc VPN
+Documentation=info:tinc
+Documentation=man:tinc(8) man:tinc.conf(5)
+Documentation=http://tinc-vpn.org/docs/
+After=network.target
+Wants=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/true
+ExecReload=/bin/true
+WorkingDirectory=@sysconfdir@/tinc
+
+[Install]
+WantedBy=multi-user.target
+++ /dev/null
-[Unit]
-Description=Tinc net %i
-Documentation=info:tinc
-Documentation=man:tinc(8) man:tinc.conf(5)
-Documentation=http://tinc-vpn.org/docs/
-PartOf=tinc.service
-ReloadPropagatedFrom=tinc.service
-
-[Service]
-Type=simple
-WorkingDirectory=/etc/tinc/%i
-ExecStart=/usr/sbin/tincd -n %i -D
-ExecReload=/usr/sbin/tinc -n %i reload
-KillMode=mixed
-Restart=on-failure
-RestartSec=5
-TimeoutStopSec=5
-
-[Install]
-WantedBy=tinc.service
--- /dev/null
+[Unit]
+Description=Tinc net %i
+Documentation=info:tinc
+Documentation=man:tinc(8) man:tinc.conf(5)
+Documentation=http://tinc-vpn.org/docs/
+PartOf=tinc.service
+ReloadPropagatedFrom=tinc.service
+
+[Service]
+Type=simple
+WorkingDirectory=@sysconfdir@/tinc/%i
+ExecStart=@sbindir@/tincd -n %i -D
+ExecReload=@sbindir@/tinc -n %i reload
+KillMode=mixed
+Restart=on-failure
+RestartSec=5
+TimeoutStopSec=5
+
+[Install]
+WantedBy=tinc.service