openwrt: include ntpclient package

This commit is contained in:
Bart Van Der Meerssche 2010-08-08 12:42:42 +02:00
parent e508f18806
commit 61851ad6b3
15 changed files with 604 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# OpenWrt version: Backfire (r22269) # OpenWrt version: Backfire (r22269)
# Sat Aug 7 14:55:22 2010 # Sun Aug 8 12:02:15 2010
# #
CONFIG_HAVE_DOT_CONFIG=y CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_ppc40x is not set # CONFIG_TARGET_ppc40x is not set
@ -1032,7 +1032,7 @@ CONFIG_PACKAGE_hotplug2=y
CONFIG_PACKAGE_libc=y CONFIG_PACKAGE_libc=y
CONFIG_PACKAGE_libgcc=y CONFIG_PACKAGE_libgcc=y
# CONFIG_PACKAGE_libpthread is not set # CONFIG_PACKAGE_libpthread is not set
# CONFIG_PACKAGE_librt is not set CONFIG_PACKAGE_librt=y
# CONFIG_PACKAGE_libstdcpp is not set # CONFIG_PACKAGE_libstdcpp is not set
CONFIG_PACKAGE_mtd=y CONFIG_PACKAGE_mtd=y
CONFIG_PACKAGE_opkg=y CONFIG_PACKAGE_opkg=y
@ -1078,6 +1078,11 @@ CONFIG_PACKAGE_zlib=y
# #
# Network # Network
# #
#
# Time Synchronization
#
CONFIG_PACKAGE_ntpclient=y
# CONFIG_PACKAGE_arptables is not set # CONFIG_PACKAGE_arptables is not set
# CONFIG_PACKAGE_crda is not set # CONFIG_PACKAGE_crda is not set
# CONFIG_PACKAGE_ebtables is not set # CONFIG_PACKAGE_ebtables is not set

View File

@ -0,0 +1,68 @@
10
dir
22525
svn://svn.openwrt.org/openwrt/packages/net/ntpclient
svn://svn.openwrt.org/openwrt
2010-01-14T19:02:19.230463Z
19134
jow
3c298f89-4303-0410-b956-a3cf2f4a3e73
files
dir
patches
dir
Makefile
file
2010-07-24T18:00:00.008391Z
c4e1830bfd3ec47c1e4bd089dcf56c7f
2010-01-14T19:02:19.230463Z
19134
jow
has-props
1310

View File

@ -0,0 +1,13 @@
K 9
copyright
V 30
Copyright (C) 2006 OpenWrt.org
K 7
licence
V 5
GPLv2
K 13
svn:eol-style
V 6
native
END

View File

@ -0,0 +1,49 @@
#
# 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
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))

View File

@ -0,0 +1,49 @@
#
# 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
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))

View File

@ -0,0 +1,96 @@
10
dir
22525
svn://svn.openwrt.org/openwrt/packages/net/ntpclient/files
svn://svn.openwrt.org/openwrt
2010-01-14T19:02:19.230463Z
19134
jow
3c298f89-4303-0410-b956-a3cf2f4a3e73
ntpclient.hotplug
file
2010-07-24T17:59:59.996391Z
45d50213e89827c0de95367b48be9f77
2010-01-14T19:02:19.230463Z
19134
jow
has-props
1599
ntpclient.config
file
2010-07-24T17:59:59.996391Z
1cf9d075c4e42397f8cd9dbc58864334
2010-01-14T19:02:19.230463Z
19134
jow
has-props
449

View File

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,78 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
. /etc/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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,78 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
. /etc/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

View File

@ -0,0 +1,62 @@
10
dir
22525
svn://svn.openwrt.org/openwrt/packages/net/ntpclient/patches
svn://svn.openwrt.org/openwrt
2008-08-14T12:03:55.318575Z
12305
blogic
3c298f89-4303-0410-b956-a3cf2f4a3e73
100-daemon.patch
file
2010-07-24T18:00:00.004390Z
5069486b9bfdad54d181524b399aa05d
2008-08-14T12:03:55.318575Z
12305
blogic
670

View File

@ -0,0 +1,24 @@
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);

View File

@ -0,0 +1,24 @@
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);