Add an hotplug script, so that if network is not up, time will be synchronised (...
authorFlorian Fainelli <florian@openwrt.org>
Fri, 3 Nov 2006 14:32:02 +0000 (14:32 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Fri, 3 Nov 2006 14:32:02 +0000 (14:32 +0000)
SVN-Revision: 5420

net/openntpd/Makefile
net/openntpd/files/ntpd.hotplug [new file with mode: 0644]

index 46917c88c728727c2110a1189f2eee55f788f7c4..12d5658017fc21237ba68e73c215b17e499e453a 100644 (file)
@@ -94,6 +94,8 @@ define Package/openntpd/install
        install -m0644 ./files/ntpd.conf $(1)/etc/
        install -d -m0755 $(1)/etc/init.d
        install -m0755 ./files/ntpd.init $(1)/etc/init.d/ntpd
+       install -d -m0755 $(1)/etc/hotplug.d/iface
+       install -m0755 ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
 endef
 
 $(eval $(call BuildPackage,openntpd))
diff --git a/net/openntpd/files/ntpd.hotplug b/net/openntpd/files/ntpd.hotplug
new file mode 100644 (file)
index 0000000..f165e6b
--- /dev/null
@@ -0,0 +1,10 @@
+NAME=ntpd
+CONFIG=/etc/$NAME.conf
+COMMAND=/usr/sbin/$NAME
+
+[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
+        [ -x $COMMAND ] && [ -r $CONFIG ] && {
+               killall ntpd
+               /etc/init.d/ntpd start
+        } &
+}