ntp: add systemd unit file for ntpd
PATCH 1/1 ntp: add systemd unit file for ntpd
--- package/ntp/ntp.mk | 13 ++++++++++++- package/ntp/ntpd.service | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 package/ntp/ntpd.service
package/ntp/ntp.mk +12 -1
@@ -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))
package/ntp/ntpd.service new file +11 -0
@@ -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
Signature · 1 line
1.8.5.3
PATCH 1/1 ntp: add systemd unit file for ntpd
Quoted 1 line · Ivan Sergeev
Signed-off-by Ivan Sergeev <[email protected]>
Quoted 20 lines
--- package/ntp/ntp.mk | 13 ++++++++++++- package/ntp/ntpd.service | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)create mode 100644 package/ntp/ntpd.service
package/ntp/ntp.mk +0
-1@@ -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
package/ntp/ntp.mk NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_TICKADJ) += util/tickadj · line 69
Quoted 10 lines
package/ntp/ntp.mk +9
-0+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
This patch makes me wonder about two things.
1. The 3 packages that currently install unit files all have this mkdir -p of multi-user.target.wants. Shouldn't that be done by the core infrastructure as part of the skeleton?
2. For sysv-init, we use /etc/init.d directly instead of the usual /etc/rcX.d with symlinks to init.d. Shouldn't we do something similar for systemd, i.e. put the unit files directly in multi-user.target.wants and begone with the symlinks?
Both of these suggestions are obviously not part of this patch, but
rather separate cleanup work, since they affect dropbear, lighttpd and openssh as well.
Regards,
Arnout
Quoted 24 lines
package/ntp/ntp.mk +3
-0+endef +endif + NTP_POST_PATCH_HOOKS += NTP_PATCH_FIXUPS $(eval $(autotools-package))package/ntp/ntpd.service new file +11
-0@@ -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
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 ntp: add systemd unit file for ntpd
Hello Arnout,
1. Yup, I believe so, but it's currently not in place in the skeleton. I think some of the proposed solutions in the network.service thread would address this.
2. The symlink into multi-user.target.wants "enables" the service, so that when systemd needs to reach the multi-user target (which it does when it boots up), it will run the service. Later, running "systemctl disable" on the service would remove the symlink, so it isn't run automatically for that target. So the symlink facilitates enabling/disabling the service for a given target, but the service file itself should live in /etc/systemd/system.
Thanks,
~vsergeev
Ivan Sergeev
Quoted 95 lines · Arnout Vandecappelle
Quoted 2 lines · Ivan Sergeev
Signed-off-by Ivan Sergeev <[email protected]>---
Quoted 36 lines
package/ntp/ntp.mk | 13 ++++++++++++- package/ntp/ntpd.service | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)create mode 100644 package/ntp/ntpd.service
package/ntp/ntp.mk +0
-0@@ -52,13 +52,24 @@ NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_TICKADJ) +=util/tickadj
defineNTP_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
endefpackage/ntp/ntp.mk +3
-0+ifeq ($(BR2_PACKAGE_NTP_NTPD),y) +define NTP_INSTALL_INIT_SYSV + $(INSTALL) -D -m 755 package/ntp/S49ntp $(TARGET_DIR)/etc/init.d/S49ntp
package/ntp/ntp.mk +4
-0+endef + +define NTP_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/ntp/ntpd.service$(TARGET_DIR)/etc/systemd/system/ntpd.service
package/ntp/ntp.mk +2
-0+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -fs ../ntpd.service $(TARGET_DIR)/etc/systemd/Quoted 2 lines
system/multi-user.target.wants/ntpd.service
This patch makes me wonder about two things.
1. The 3 packages that currently install unit files all have this mkdir -p of multi-user.target.wants. Shouldn't that be done by the core infrastructure as part of the skeleton?
2. For sysv-init, we use
/etc/init.ddirectly instead of the usual/etc/rcX.dwith symlinks to init.d. Shouldn't we do something similar for systemd, i.e. put the unit files directly in multi-user.target.wants and begone with the symlinks?Both of these suggestions are obviously not part of this patch, but
rather separate cleanup work, since they affect dropbear, lighttpd and openssh as well.Regards,
Arnout+endef
Quoted 14 lines
package/ntp/ntp.mk +2
-0+endif + NTP_POST_PATCH_HOOKS += NTP_PATCH_FIXUPS $(eval $(autotools-package))package/ntp/ntpd.service new file +1
-0@@ -0,0 +1,11 @@ +[Unit]package/ntp/ntpd.service line 11
Quoted 10 lines
package/ntp/ntpd.service new file +10
-0+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--
Quoted 7 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140128/8dc98066/attachment.html>
Thomas Petazzoni
AppliedPATCH 1/1 ntp: add systemd unit file for ntpd
In reply to Ivan SergeevDear Ivan Sergeev,
Quoted 6 lines · Ivan Sergeev
Signed-off-by Ivan Sergeev <[email protected]>--- package/ntp/ntp.mk | 13 ++++++++++++- package/ntp/ntpd.service | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 package/ntp/ntpd.service
Applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com