busybox: Add NTP startup script
PATCH 1/1 busybox: Add NTP startup script
Signed-off-by Maxime Hadjinlian <[email protected]>
--- package/busybox/S49ntp | 25 +++++++++++++++++++++++++ package/busybox/busybox.mk | 10 ++++++++++ package/busybox/ntpd.etc.conf | 4 ++++ 3 files changed, 39 insertions(+) create mode 100644 package/busybox/S49ntp create mode 100644 package/busybox/ntpd.etc.conf
package/busybox/S49ntp new file +25 -0
@@ -0,0 +1,25 @@ +#!/bin/sh + +[ -x /usr/sbin/ntpd ] || exit 0 +[ -f /etc/ntpd.conf ] || exit 0 + +case "$1" in + start) + echo -n "Starting ntpd: " + start-stop-daemon -S -x /usr/sbin/ntpd -- -l + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + echo -n "Stopping ntpd: " + start-stop-daemon -K -q -x /usr/sbin/ntpd + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + restart) + "$0" stop + sleep 1 + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + ;; +esac
package/busybox/busybox.mk +10 -0
@@ -126,6 +126,15 @@ define BUSYBOX_INTERNAL_SHADOW_PASSWORDS endef endif +define BUSYBOX_INSTALL_NTP_SCRIPT + if grep -q CONFIG_NTPD=y $(@D)/.config; then \ + $(INSTALL) -m 0755 -D package/busybox/S49ntp \ + $(TARGET_DIR)/etc/init.d/S49ntp; \ + $(INSTALL) -m 0755 -D package/busybox/ntpd.etc.conf \ + $(TARGET_DIR)/etc/ntp.conf; \ + fi +endef + define BUSYBOX_INSTALL_UDHCPC_SCRIPT if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \ $(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
@@ -204,6 +213,7 @@ endef define BUSYBOX_INSTALL_TARGET_CMDS $(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D) install $(BUSYBOX_INSTALL_INITTAB) + $(BUSYBOX_INSTALL_NTP_SCRIPT) $(BUSYBOX_INSTALL_UDHCPC_SCRIPT) $(BUSYBOX_INSTALL_MDEV_CONF) endef
package/busybox/ntpd.etc.conf new file +4 -0
@@ -0,0 +1,4 @@ +server 0.pool.ntp.org +server 1.pool.ntp.org +server 3.pool.ntp.org +server 4.pool.ntp.org
Signature · 1 line
2.1.4
PATCH 1/1 busybox: Add NTP startup script
Dear Maxime Hadjinlian,
Quoted 8 lines · Maxime Hadjinlian
Signed-off-by Maxime Hadjinlian <[email protected]>--- package/busybox/S49ntp | 25 +++++++++++++++++++++++++ package/busybox/busybox.mk | 10 ++++++++++ package/busybox/ntpd.etc.conf | 4 ++++ 3 files changed, 39 insertions(+) create mode 100644 package/busybox/S49ntp create mode 100644 package/busybox/ntpd.etc.conf
I wanted to apply this, but unfortunately, ntpd doesn't work here because it really wants my kernel to have IPv6 support.
But other than that, I had done some other changes to your patch, see the attached patch for the latest version I had.
Can you look into this IPv6 related issue and see if it can be solved, or at least a bug report filed with the Busybox people.
Thanks!
Thomas
Signature · 10 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-busybox-Add-NTP-startup-script.patch Type: text/x-patch Size: 2797 bytes Desc: not available URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150713/3280081d/attachment.bin>