Fix the hotplug script and add a kakikaze config file (#1083)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@6920 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2007-04-10 10:58:00 +00:00
parent 69cd8303d9
commit ab58392db6
2 changed files with 32 additions and 5 deletions

View File

@ -0,0 +1,3 @@
config timezone
option posixtz "CET-1CEST,M3.5.0,M10.5.0/3"
option zoneinfo "Europe/Paris"

View File

@ -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