summaryrefslogtreecommitdiff
path: root/package/ntp
diff options
context:
space:
mode:
authorIvan Sergeev <vsergeev@kumunetworks.com>2014-01-27 18:00:05 -0800
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-03-07 22:54:05 +0100
commit16208184a2823404127c2304e6ea1a986d1113c2 (patch)
treea52647228124349910792f81aa7d57d354ddeee6 /package/ntp
parent7bf9aba89357e07f7367a3fa2449c8e4a3e7db56 (diff)
ntp: add systemd unit file for ntpd
Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/ntp')
-rw-r--r--package/ntp/ntp.mk13
-rw-r--r--package/ntp/ntpd.service11
2 files changed, 23 insertions, 1 deletions
diff --git a/package/ntp/ntp.mk b/package/ntp/ntp.mk
index 40d8e4fcd..fe64a2180 100644
--- a/package/ntp/ntp.mk
+++ b/package/ntp/ntp.mk
@@ -52,13 +52,24 @@ NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_TICKADJ) += util/tickadj
define NTP_INSTALL_TARGET_CMDS
$(if $(BR2_PACKAGE_NTP_NTPD), install -m 755 $(@D)/ntpd/ntpd $(TARGET_DIR)/usr/sbin/ntpd)
test -z "$(NTP_INSTALL_FILES_y)" || install -m 755 $(addprefix $(@D)/,$(NTP_INSTALL_FILES_y)) $(TARGET_DIR)/usr/bin/
- $(if $(BR2_PACKAGE_NTP_NTPD), install -m 755 package/ntp/S49ntp $(TARGET_DIR)/etc/init.d/S49ntp)
@if [ ! -f $(TARGET_DIR)/etc/default/ntpd ]; then \
install -m 755 -d $(TARGET_DIR)/etc/default ; \
install -m 644 package/ntp/ntpd.etc.default $(TARGET_DIR)/etc/default/ntpd ; \
fi
endef
+ifeq ($(BR2_PACKAGE_NTP_NTPD),y)
+define NTP_INSTALL_INIT_SYSV
+ $(INSTALL) -D -m 755 package/ntp/S49ntp $(TARGET_DIR)/etc/init.d/S49ntp
+endef
+
+define NTP_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 644 package/ntp/ntpd.service $(TARGET_DIR)/etc/systemd/system/ntpd.service
+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+ ln -fs ../ntpd.service $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ntpd.service
+endef
+endif
+
NTP_POST_PATCH_HOOKS += NTP_PATCH_FIXUPS
$(eval $(autotools-package))
diff --git a/package/ntp/ntpd.service b/package/ntp/ntpd.service
new file mode 100644
index 000000000..7964c5389
--- /dev/null
+++ b/package/ntp/ntpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Network Time Service
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/ntpd.pid
+ExecStart=/usr/sbin/ntpd -g -p /run/ntpd.pid
+
+[Install]
+WantedBy=multi-user.target