summaryrefslogtreecommitdiff
path: root/package/utils
diff options
context:
space:
mode:
authorSteven Barth <cyrus@openwrt.org>2014-11-28 11:41:25 +0000
committerSteven Barth <cyrus@openwrt.org>2014-11-28 11:41:25 +0000
commit016d6acde5984a68e1904e21fdca32053e4c0dca (patch)
tree76d5361e56c14f8ef4c8af5e34567e6327afb322 /package/utils
parentd73dc14957000f34310b4980d95f76c60a61bee6 (diff)
downloadmtk-20170518-016d6acde5984a68e1904e21fdca32053e4c0dca.zip
mtk-20170518-016d6acde5984a68e1904e21fdca32053e4c0dca.tar.gz
mtk-20170518-016d6acde5984a68e1904e21fdca32053e4c0dca.tar.bz2
ntp: add hotplug class for ntp-events
Based on a patch by Luiz Angelo Daros de Luca Signed-off-by: Steven Barth <steven@midlink.org> SVN-Revision: 43421
Diffstat (limited to 'package/utils')
-rw-r--r--package/utils/busybox/Makefile3
-rwxr-xr-xpackage/utils/busybox/files/ntpd-hotplug3
-rwxr-xr-xpackage/utils/busybox/files/sysntpd2
3 files changed, 7 insertions, 1 deletions
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 718cf78..fcfdc8b 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=busybox
PKG_VERSION:=1.22.1
-PKG_RELEASE:=4
+PKG_RELEASE:=5
PKG_FLAGS:=essential
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
@@ -116,6 +116,7 @@ define Package/busybox/install
$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
$(INSTALL_BIN) ./files/telnet $(1)/etc/init.d/telnet
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
+ $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
-rm -rf $(1)/lib64
endef
diff --git a/package/utils/busybox/files/ntpd-hotplug b/package/utils/busybox/files/ntpd-hotplug
new file mode 100755
index 0000000..ddc1490
--- /dev/null
+++ b/package/utils/busybox/files/ntpd-hotplug
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ "$1" = stratum ] || exit 0
+ACTION="$1" /sbin/hotplug-call ntp
diff --git a/package/utils/busybox/files/sysntpd b/package/utils/busybox/files/sysntpd
index 417addf..f73bb83 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -5,6 +5,7 @@ START=98
USE_PROCD=1
PROG=/usr/sbin/ntpd
+HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
validate_ntp_section() {
uci_validate_section system timeserver "${1}" \
@@ -26,6 +27,7 @@ start_service() {
procd_open_instance
procd_set_param command "$PROG" -n
[ "$enable_server" = "1" ] && procd_append_param command -l
+ [ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S "$HOTPLUG_SCRIPT"
for peer in $server; do
procd_append_param command -p $peer
done