ntpclient: moved to github
git-svn-id: svn://svn.openwrt.org/openwrt/packages@42163 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
f5dbaf3f45
commit
cfa1a1ef9e
@ -1,53 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2006-2010 OpenWrt.org
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=ntpclient
|
|
||||||
PKG_VERSION:=2007_365
|
|
||||||
PKG_RELEASE:=4
|
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
|
|
||||||
PKG_SOURCE_URL:=http://doolittle.icarus.com/ntpclient/
|
|
||||||
PKG_MD5SUM:=cb98711f11769cdd22fc592844cef414
|
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2007
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Package/ntpclient
|
|
||||||
SUBMENU:=Time Synchronization
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=NTP (Network Time Protocol) client
|
|
||||||
URL:=http://doolittle.icarus.com/ntpclient/
|
|
||||||
DEPENDS:=+librt
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/ntpclient/description
|
|
||||||
NTP client for setting system time from NTP servers.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/ntpclient/conffiles
|
|
||||||
/etc/config/ntpclient
|
|
||||||
endef
|
|
||||||
|
|
||||||
MAKE_FLAGS += \
|
|
||||||
all adjtimex
|
|
||||||
|
|
||||||
define Package/ntpclient/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
|
||||||
$(INSTALL_DATA) ./files/ntpclient.hotplug $(1)/etc/hotplug.d/iface/20-ntpclient
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(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/
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rate.awk $(1)/usr/sbin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,ntpclient))
|
|
@ -1,23 +0,0 @@
|
|||||||
config ntpserver
|
|
||||||
option hostname '0.openwrt.pool.ntp.org'
|
|
||||||
option port '123'
|
|
||||||
|
|
||||||
config ntpserver
|
|
||||||
option hostname '1.openwrt.pool.ntp.org'
|
|
||||||
option port '123'
|
|
||||||
|
|
||||||
config ntpserver
|
|
||||||
option hostname '2.openwrt.pool.ntp.org'
|
|
||||||
option port '123'
|
|
||||||
|
|
||||||
config ntpserver
|
|
||||||
option hostname '3.openwrt.pool.ntp.org'
|
|
||||||
option port '123'
|
|
||||||
|
|
||||||
config ntpdrift
|
|
||||||
option freq '0'
|
|
||||||
|
|
||||||
config ntpclient
|
|
||||||
option interval 600
|
|
||||||
#option count 10
|
|
||||||
#option interface wan
|
|
@ -1,78 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
|
|
||||||
unset SERVER
|
|
||||||
unset PORT
|
|
||||||
unset INTERVAL
|
|
||||||
unset COUNT
|
|
||||||
unset INTERFACE_GLOBAL
|
|
||||||
|
|
||||||
NTPC=`which ntpclient`
|
|
||||||
|
|
||||||
check_server() {
|
|
||||||
local hostname
|
|
||||||
local port
|
|
||||||
local interface
|
|
||||||
[ -n "$SERVER" ] && return
|
|
||||||
config_get hostname $1 hostname
|
|
||||||
config_get port $1 port
|
|
||||||
config_get interface $1 interface
|
|
||||||
|
|
||||||
[ -z "$interface" ] && interface=$INTERFACE_GLOBAL
|
|
||||||
|
|
||||||
[ -n "$interface" ] && {
|
|
||||||
# $INTERFACE is passed from hotplug event
|
|
||||||
[ "$interface" = "$INTERFACE" ] || return
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -z "$hostname" ] && return
|
|
||||||
$NTPC -c 1 -p ${port:-123} -i 2 -h $hostname > /dev/null && { SERVER=$hostname; PORT=${port:-123}; }
|
|
||||||
}
|
|
||||||
|
|
||||||
set_drift() {
|
|
||||||
config_get freq $1 freq
|
|
||||||
[ -n "$freq" ] && adjtimex -f $freq >/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
start_ntpclient() {
|
|
||||||
config_foreach set_drift ntpdrift
|
|
||||||
config_foreach check_server ntpserver
|
|
||||||
[ -z "$SERVER" ] && exit 0
|
|
||||||
logger starting ntpclient
|
|
||||||
$NTPC ${COUNT:+-c $COUNT} ${INTERVAL:+-i $INTERVAL} -s -l -D -p $PORT -h $SERVER 2> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_ntpclient() {
|
|
||||||
logger stopping ntpclient
|
|
||||||
killall ntpclient
|
|
||||||
}
|
|
||||||
|
|
||||||
load_settings() {
|
|
||||||
local interval
|
|
||||||
local count
|
|
||||||
local iface
|
|
||||||
|
|
||||||
config_get interval $1 interval
|
|
||||||
config_get count $1 count
|
|
||||||
config_get interface $1 interface
|
|
||||||
|
|
||||||
[ -n "$count" ] && COUNT=$count
|
|
||||||
[ -n "$interval" ] && INTERVAL=$interval
|
|
||||||
[ -n "$interface" ] && INTERFACE_GLOBAL=$interface
|
|
||||||
}
|
|
||||||
|
|
||||||
config_load ntpclient
|
|
||||||
config_foreach load_settings ntpclient
|
|
||||||
|
|
||||||
NTP_RUNNING=`ps | grep $NTPC | grep -v grep`
|
|
||||||
|
|
||||||
case "${ACTION:-ifup}" in
|
|
||||||
ifup)
|
|
||||||
[ -z "$NTP_RUNNING" ] && start_ntpclient
|
|
||||||
;;
|
|
||||||
ifdown)
|
|
||||||
[ -n "$NTP_RUNNING" ] && stop_ntpclient
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -1,24 +0,0 @@
|
|||||||
Index: ntpclient-2007/ntpclient.c
|
|
||||||
===================================================================
|
|
||||||
--- ntpclient-2007.orig/ntpclient.c 2008-08-12 03:11:34.000000000 +0200
|
|
||||||
+++ ntpclient-2007/ntpclient.c 2008-08-12 03:11:36.000000000 +0200
|
|
||||||
@@ -614,7 +614,7 @@
|
|
||||||
ntpc.cross_check=1;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
- c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "st");
|
|
||||||
+ c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "stD");
|
|
||||||
if (c == EOF) break;
|
|
||||||
switch (c) {
|
|
||||||
case 'c':
|
|
||||||
@@ -663,6 +663,10 @@
|
|
||||||
(ntpc.cross_check)=0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case 'D':
|
|
||||||
+ daemon();
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
exit(1);
|
|
Loading…
x
Reference in New Issue
Block a user