From 2e5895c173d4cceb5426619ab877d72671da849d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 16 Aug 2017 22:24:09 -0400 Subject: Make installation paths and such configurable This doesn't change the default behavior at all. --- .gitignore | 2 ++ Makefile | 36 ++++++++++++++++++++++++-------- systemd-timesyncd-wait.service | 11 ---------- systemd-timesyncd-wait.service.in | 11 ++++++++++ systemd-timesyncd.service.d-wait.conf | 11 ---------- systemd-timesyncd.service.d-wait.conf.in | 11 ++++++++++ 6 files changed, 51 insertions(+), 31 deletions(-) delete mode 100644 systemd-timesyncd-wait.service create mode 100644 systemd-timesyncd-wait.service.in delete mode 100644 systemd-timesyncd.service.d-wait.conf create mode 100644 systemd-timesyncd.service.d-wait.conf.in 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..5be885b 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 = /usr +rootprefix = $(prefix) +rootlibexecdir = $(rootprefix)/lib/systemd +systemunitdir=$(rootprefix)/lib/systemd/system + +TIMESYNCD_PATH = $(rootlibexecdir)/systemd-timesyncd +RM = /usr/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,13 @@ 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 $< $@ diff --git a/systemd-timesyncd-wait.service b/systemd-timesyncd-wait.service deleted file mode 100644 index 3237130..0000000 --- a/systemd-timesyncd-wait.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Network Time Synchronized -DefaultDependencies=no -After=systemd-timesyncd-wait.socket -Before=time-sync.target -Wants=time-sync.target systemd-timesyncd-wait.socket - -[Service] -Type=oneshot -ExecStart=/usr/lib/systemd/systemd-timesyncd-wait -TimeoutStartSec=infinity diff --git a/systemd-timesyncd-wait.service.in b/systemd-timesyncd-wait.service.in new file mode 100644 index 0000000..e356dae --- /dev/null +++ b/systemd-timesyncd-wait.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Network Time Synchronized +DefaultDependencies=no +After=systemd-timesyncd-wait.socket +Before=time-sync.target +Wants=time-sync.target systemd-timesyncd-wait.socket + +[Service] +Type=oneshot +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 b66b18b..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 /usr/lib/systemd/systemd-timesyncd -ExecStopPost=/usr/bin/rm -f -- /run/timesyncd/notify.sock -ExecStartPre=/usr/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 -- cgit v1.1-4-g5e80