summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile39
-rw-r--r--systemd-timesyncd-wait.service.in (renamed from systemd-timesyncd-wait.service)2
-rw-r--r--systemd-timesyncd.service.d-wait.conf11
-rw-r--r--systemd-timesyncd.service.d-wait.conf.in11
5 files changed, 44 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore
index f2c3279..9774793 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/systemd-timesyncd-wait
/systemd-timesyncd-wrap
+/systemd-timesyncd.service.d-wait.conf
+/systemd-timesyncd-wait.service
diff --git a/Makefile b/Makefile
index 282ed1a..7a4b797 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,23 @@
-files.out.all += systemd-timesyncd-wait systemd-timesyncd-wrap
-files.sys.all += /usr/lib/systemd/systemd-timesyncd-wait
-files.sys.all += /usr/lib/systemd/systemd-timesyncd-wrap
-files.sys.all += /usr/lib/systemd/system/systemd-timesyncd-wait.socket
-files.sys.all += /usr/lib/systemd/system/systemd-timesyncd-wait.service
-files.sys.all += /usr/lib/systemd/system/systemd-timesyncd.service.d/wait.conf
+prefix = /
+rootprefix = $(prefix)
+rootlibexecdir = $(rootprefix)/lib/systemd
+systemunitdir=$(rootprefix)/lib/systemd/system
+
+TIMESYNCD_PATH = $(rootlibexecdir)/systemd-timesyncd
+RM = /bin/rm
+
+####
+
+files.out.all += systemd-timesyncd-wait
+files.out.all += systemd-timesyncd-wrap
+files.out.all += systemd-timesyncd.service.d-wait.conf
+files.out.all += systemd-timesyncd-wait.service
+
+files.sys.all += $(rootlibexecdir)/systemd-timesyncd-wait
+files.sys.all += $(rootlibexecdir)/systemd-timesyncd-wrap
+files.sys.all += $(systemunitdir)/systemd-timesyncd-wait.socket
+files.sys.all += $(systemunitdir)/systemd-timesyncd-wait.service
+files.sys.all += $(systemunitdir)/systemd-timesyncd.service.d/wait.conf
outdir = .
srcdir = .
@@ -16,9 +30,16 @@ install: $(addprefix $(DESTDIR),$(files.sys.all))
$(outdir)/%: $(srcdir)/%.go
go build -o $@ $<
-$(DESTDIR)/usr/lib/systemd/%: $(outdir)/%
+vars = rootlibexecdir TIMESYNCD_PATH RM
+$(outdir)/%: $(srcdir)/%.in
+ sed $(foreach v,$(vars),-e 's|@$v@|$($v)|g') < $< > $@
+
+$(DESTDIR)$(rootlibexecdir)/%: $(outdir)/%
install -DTm755 $< $@
-$(DESTDIR)/usr/lib/systemd/system/%: $(srcdir)/%
+$(DESTDIR)$(systemunitdir)/%: $(srcdir)/%
install -DTm644 $< $@
-$(DESTDIR)/usr/lib/systemd/system/systemd-timesyncd.service.d/wait.conf: systemd-timesyncd.service.d-wait.conf
+$(DESTDIR)$(systemunitdir)/systemd-timesyncd.service.d/wait.conf: $(outdir)/systemd-timesyncd.service.d-wait.conf
install -DTm644 $< $@
+
+.SECONDARY:
+.DELETE_ON_ERROR:
diff --git a/systemd-timesyncd-wait.service b/systemd-timesyncd-wait.service.in
index 3237130..e356dae 100644
--- a/systemd-timesyncd-wait.service
+++ b/systemd-timesyncd-wait.service.in
@@ -7,5 +7,5 @@ Wants=time-sync.target systemd-timesyncd-wait.socket
[Service]
Type=oneshot
-ExecStart=/usr/lib/systemd/systemd-timesyncd-wait
+ExecStart=@rootlibexecdir@/systemd-timesyncd-wait
TimeoutStartSec=infinity
diff --git a/systemd-timesyncd.service.d-wait.conf b/systemd-timesyncd.service.d-wait.conf
deleted file mode 100644
index 7098f0d..0000000
--- a/systemd-timesyncd.service.d-wait.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Wants=systemd-timesyncd-wait.socket systemd-timesyncd-wait.service
-After=systemd-timesyncd-wait.socket
-
-[Service]
-Sockets=
-ExecStart=
-ExecStart=/usr/lib/systemd/systemd-timesyncd-wrap /lib/systemd/systemd-timesyncd
-ExecStopPost=/bin/rm -f -- /run/timesyncd/notify.sock
-ExecStartPre=/bin/rm -f -- /run/timesyncd/notify.sock
-NotifyAccess=all
diff --git a/systemd-timesyncd.service.d-wait.conf.in b/systemd-timesyncd.service.d-wait.conf.in
new file mode 100644
index 0000000..2b29b52
--- /dev/null
+++ b/systemd-timesyncd.service.d-wait.conf.in
@@ -0,0 +1,11 @@
+[Unit]
+Wants=systemd-timesyncd-wait.socket systemd-timesyncd-wait.service
+After=systemd-timesyncd-wait.socket
+
+[Service]
+Sockets=
+ExecStart=
+ExecStart=@rootlibexecdir@/systemd-timesyncd-wrap @TIMESYNCD_PATH@
+ExecStopPost=@RM@ -f -- /run/timesyncd/notify.sock
+ExecStartPre=@RM@ -f -- /run/timesyncd/notify.sock
+NotifyAccess=all