From 61851ad6b3d37242fa76bfca8742490bc6d07ff3 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Sun, 8 Aug 2010 12:42:42 +0200 Subject: [PATCH] openwrt: include ntpclient package --- mote/v2/openwrt/.config | 9 +- .../v2/openwrt/package/ntpclient/.svn/entries | 68 +++++++++++++ .../.svn/prop-base/Makefile.svn-base | 13 +++ .../.svn/text-base/Makefile.svn-base | 49 ++++++++++ mote/v2/openwrt/package/ntpclient/Makefile | 49 ++++++++++ .../package/ntpclient/files/.svn/entries | 96 +++++++++++++++++++ .../.svn/prop-base/ntpclient.config.svn-base | 5 + .../.svn/prop-base/ntpclient.hotplug.svn-base | 5 + .../.svn/text-base/ntpclient.config.svn-base | 23 +++++ .../.svn/text-base/ntpclient.hotplug.svn-base | 78 +++++++++++++++ .../package/ntpclient/files/ntpclient.config | 23 +++++ .../package/ntpclient/files/ntpclient.hotplug | 78 +++++++++++++++ .../package/ntpclient/patches/.svn/entries | 62 ++++++++++++ .../.svn/text-base/100-daemon.patch.svn-base | 24 +++++ .../ntpclient/patches/100-daemon.patch | 24 +++++ 15 files changed, 604 insertions(+), 2 deletions(-) create mode 100644 mote/v2/openwrt/package/ntpclient/.svn/entries create mode 100644 mote/v2/openwrt/package/ntpclient/.svn/prop-base/Makefile.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/.svn/text-base/Makefile.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/Makefile create mode 100644 mote/v2/openwrt/package/ntpclient/files/.svn/entries create mode 100644 mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.config.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.hotplug.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.config.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.hotplug.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/files/ntpclient.config create mode 100644 mote/v2/openwrt/package/ntpclient/files/ntpclient.hotplug create mode 100644 mote/v2/openwrt/package/ntpclient/patches/.svn/entries create mode 100644 mote/v2/openwrt/package/ntpclient/patches/.svn/text-base/100-daemon.patch.svn-base create mode 100644 mote/v2/openwrt/package/ntpclient/patches/100-daemon.patch diff --git a/mote/v2/openwrt/.config b/mote/v2/openwrt/.config index ad1704a..96252c1 100644 --- a/mote/v2/openwrt/.config +++ b/mote/v2/openwrt/.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # OpenWrt version: Backfire (r22269) -# Sat Aug 7 14:55:22 2010 +# Sun Aug 8 12:02:15 2010 # CONFIG_HAVE_DOT_CONFIG=y # CONFIG_TARGET_ppc40x is not set @@ -1032,7 +1032,7 @@ CONFIG_PACKAGE_hotplug2=y CONFIG_PACKAGE_libc=y CONFIG_PACKAGE_libgcc=y # CONFIG_PACKAGE_libpthread is not set -# CONFIG_PACKAGE_librt is not set +CONFIG_PACKAGE_librt=y # CONFIG_PACKAGE_libstdcpp is not set CONFIG_PACKAGE_mtd=y CONFIG_PACKAGE_opkg=y @@ -1078,6 +1078,11 @@ CONFIG_PACKAGE_zlib=y # # Network # + +# +# Time Synchronization +# +CONFIG_PACKAGE_ntpclient=y # CONFIG_PACKAGE_arptables is not set # CONFIG_PACKAGE_crda is not set # CONFIG_PACKAGE_ebtables is not set diff --git a/mote/v2/openwrt/package/ntpclient/.svn/entries b/mote/v2/openwrt/package/ntpclient/.svn/entries new file mode 100644 index 0000000..c9fd280 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/.svn/entries @@ -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 + diff --git a/mote/v2/openwrt/package/ntpclient/.svn/prop-base/Makefile.svn-base b/mote/v2/openwrt/package/ntpclient/.svn/prop-base/Makefile.svn-base new file mode 100644 index 0000000..f899379 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/.svn/prop-base/Makefile.svn-base @@ -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 diff --git a/mote/v2/openwrt/package/ntpclient/.svn/text-base/Makefile.svn-base b/mote/v2/openwrt/package/ntpclient/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..6f7d0b8 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/.svn/text-base/Makefile.svn-base @@ -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)) diff --git a/mote/v2/openwrt/package/ntpclient/Makefile b/mote/v2/openwrt/package/ntpclient/Makefile new file mode 100644 index 0000000..6f7d0b8 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/Makefile @@ -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)) diff --git a/mote/v2/openwrt/package/ntpclient/files/.svn/entries b/mote/v2/openwrt/package/ntpclient/files/.svn/entries new file mode 100644 index 0000000..36c1b8c --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/.svn/entries @@ -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 + diff --git a/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.config.svn-base b/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.config.svn-base new file mode 100644 index 0000000..bdbd305 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.config.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:eol-style +V 6 +native +END diff --git a/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.hotplug.svn-base b/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.hotplug.svn-base new file mode 100644 index 0000000..bdbd305 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/.svn/prop-base/ntpclient.hotplug.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:eol-style +V 6 +native +END diff --git a/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.config.svn-base b/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.config.svn-base new file mode 100644 index 0000000..10be886 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.config.svn-base @@ -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 diff --git a/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.hotplug.svn-base b/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.hotplug.svn-base new file mode 100644 index 0000000..c932688 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/.svn/text-base/ntpclient.hotplug.svn-base @@ -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 diff --git a/mote/v2/openwrt/package/ntpclient/files/ntpclient.config b/mote/v2/openwrt/package/ntpclient/files/ntpclient.config new file mode 100644 index 0000000..10be886 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/ntpclient.config @@ -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 diff --git a/mote/v2/openwrt/package/ntpclient/files/ntpclient.hotplug b/mote/v2/openwrt/package/ntpclient/files/ntpclient.hotplug new file mode 100644 index 0000000..c932688 --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/files/ntpclient.hotplug @@ -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 diff --git a/mote/v2/openwrt/package/ntpclient/patches/.svn/entries b/mote/v2/openwrt/package/ntpclient/patches/.svn/entries new file mode 100644 index 0000000..74e763d --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/patches/.svn/entries @@ -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 + diff --git a/mote/v2/openwrt/package/ntpclient/patches/.svn/text-base/100-daemon.patch.svn-base b/mote/v2/openwrt/package/ntpclient/patches/.svn/text-base/100-daemon.patch.svn-base new file mode 100644 index 0000000..0ff8d5e --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/patches/.svn/text-base/100-daemon.patch.svn-base @@ -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); diff --git a/mote/v2/openwrt/package/ntpclient/patches/100-daemon.patch b/mote/v2/openwrt/package/ntpclient/patches/100-daemon.patch new file mode 100644 index 0000000..0ff8d5e --- /dev/null +++ b/mote/v2/openwrt/package/ntpclient/patches/100-daemon.patch @@ -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);