From 381b722f0cd312ba6f60c38d9891810a8470de1e Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 10 Apr 2007 10:58:00 +0000 Subject: [PATCH] Fix the hotplug script and add a kakikaze config file (#1083) SVN-Revision: 6920 --- net/openntpd/files/ntpd.config | 3 +++ net/openntpd/files/ntpd.hotplug | 34 ++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 net/openntpd/files/ntpd.config diff --git a/net/openntpd/files/ntpd.config b/net/openntpd/files/ntpd.config new file mode 100644 index 0000000000..192ae7b6cd --- /dev/null +++ b/net/openntpd/files/ntpd.config @@ -0,0 +1,3 @@ +config timezone + option posixtz "CET-1CEST,M3.5.0,M10.5.0/3" + option zoneinfo "Europe/Paris" diff --git a/net/openntpd/files/ntpd.hotplug b/net/openntpd/files/ntpd.hotplug index f165e6b21e..1b8f1dad7d 100644 --- a/net/openntpd/files/ntpd.hotplug +++ b/net/openntpd/files/ntpd.hotplug @@ -2,9 +2,33 @@ 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 - } & +. /etc/functions.sh + +config_cb() { + local cfg="$CONFIG_SECTION" + local cfgtype + config_get cfgtype "$cfg" TYPE + + case "$cfgtype" in + timezone) + config_get posixtz $cfg posixtz + config_get zoneinfo $cfg zoneinfo + + ps x | grep 'ntpd' >&- || { + route -n 2>&- | grep '^0.0.0.0' >&- && { + echo "$posixtz" > /etc/TZ + /etc/init.d/ntpd start + } + } + ;; + esac } + +case "${ACTION:-ifup}" in + ifup) + config_load timezone& + ;; + ifdown) + route -n 2>&- | grep '^0.0.0.0' >&- || /etc/init.d/ntpd stop 2>&- >&- + ;; +esac -- 2.30.2