From: Oliver Ertl Date: Mon, 30 Jul 2007 08:34:04 +0000 (+0000) Subject: ntpclient: fix and cleanup X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;h=eaecfd8ef2cf2ac1363c39eb6854725d75274b3e ntpclient: fix and cleanup SVN-Revision: 8222 --- diff --git a/net/ntpclient/Makefile b/net/ntpclient/Makefile index 56c8a3c075..0e44e828cd 100644 --- a/net/ntpclient/Makefile +++ b/net/ntpclient/Makefile @@ -10,12 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ntpclient PKG_VERSION:=2003_194 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://doolittle.icarus.com/ntpclient/ PKG_MD5SUM:=94e84d5c6023c5e1f3890b28d0a08c92 -PKG_CAT:=zcat PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -30,15 +29,14 @@ define Package/ntpclient URL:=http://doolittle.icarus.com/ntpclient/ endef -define Build/Compile - $(call Build/Compile/Default,all adjtimex) -endef +MAKE_FLAGS += \ + all adjtimex define Package/ntpclient/install $(INSTALL_DIR) $(1)/etc/hotplug.d/iface - $(INSTALL_BIN) ./files/ntpclient.init $(1)/etc/hotplug.d/iface/20-ntpclient + $(INSTALL_DATA) ./files/ntpclient.hotplug $(1)/etc/hotplug.d/iface/20-ntpclient $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/ntpclient.config $(1)/etc/config/ntp_client + $(INSTALL_CONF) ./files/ntpclient.config $(1)/etc/config/ntpclient $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpclient $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/adjtimex $(1)/usr/sbin/ diff --git a/net/ntpclient/files/ntpclient.config b/net/ntpclient/files/ntpclient.config index 5be82ca168..8e2717d6e1 100644 --- a/net/ntpclient/files/ntpclient.config +++ b/net/ntpclient/files/ntpclient.config @@ -1,9 +1,9 @@ -config ntp_client +config ntpclient option hostname 'pool.ntp.org' option port '123' option count '1' -config ntp_client +config ntpclient option hostname 'ntp.ubuntu.com' option port '123' option count '1' diff --git a/net/ntpclient/files/ntpclient.hotplug b/net/ntpclient/files/ntpclient.hotplug new file mode 100644 index 0000000000..a3ce8b859a --- /dev/null +++ b/net/ntpclient/files/ntpclient.hotplug @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +. /etc/functions.sh + +DONE=0 +config_cb() { + local cfg="$CONFIG_SECTION" + local cfgtype + config_get cfgtype "$cfg" TYPE + + case "$cfgtype" in + ntpclient) + config_get hostname $cfg hostname + config_get port $cfg port + config_get count $cfg count + + [ "$DONE" = "1" ] && exit 0 + ps x | grep 'bin/[n]tpclient' >&- || { + route -n 2>&- | grep '^0.0.0.0' >&- && { + /usr/sbin/ntpclient -c ${count:-1} -s -h $hostname -p ${port:-123} 2>&- >&- && DONE=1 + } + } + ;; + esac +} +case "${ACTION:-ifup}" in + ifup) + config_load ntpclient& + ;; + ifdown) + route -n 2>&- | grep '^0.0.0.0' >&- || killall ntpclient 2>&- >&- + ;; +esac diff --git a/net/ntpclient/files/ntpclient.init b/net/ntpclient/files/ntpclient.init deleted file mode 100644 index 306c2816fb..0000000000 --- a/net/ntpclient/files/ntpclient.init +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org - -. /etc/functions.sh - -DONE=0 -config_cb() { - local cfg="$CONFIG_SECTION" - local cfgtype - config_get cfgtype "$cfg" TYPE - - case "$cfgtype" in - ntp_client) - config_get hostname $cfg hostname - config_get port $cfg port - config_get count $cfg count - - [ "$DONE" = "1" ] && exit 0 - ps x | grep 'bin/[n]tpclient' >&- || { - route -n 2>&- | grep '^0.0.0.0' >&- && { - /usr/sbin/ntpclient -c ${count:-1} -s -h $hostname -p ${port:-123} 2>&- >&- && DONE=1 - } - } - ;; - esac -} -case "${ACTION:-ifup}" in - ifup) - config_load ntp_client& - ;; - ifdown) - route -n 2>&- | grep '^0.0.0.0' >&- || killall ntpclient 2>&- >&- - ;; -esac