chrony: moved to github
chrony: moved to github

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>


git-svn-id: svn://svn.openwrt.org/openwrt/packages@47524 3c298f89-4303-0410-b956-a3cf2f4a3e73

file:a/net/chrony/Makefile (deleted)
#  
# Copyright (C) 2006-2012 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:=chrony  
PKG_VERSION:=1.26  
PKG_RELEASE:=2  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:= ftp://download.tuxfamily.org/projects/chrony/ \  
http://download.tuxfamily.org/chrony/  
PKG_MD5SUM:=ad6dd619ff1986e4ff780363c64e2246  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/chrony  
SUBMENU:=Time Synchronization  
SECTION:=net  
CATEGORY:=Network  
DEPENDS:=+libreadline +libncurses @!TARGET_avr32 @!powerpc  
TITLE:=NTP client/server for on-demand connections  
URL:=http://chrony.sunsite.dk/  
endef  
 
define Package/chrony/description  
A NTP implementation that has been specifically written to work  
well in the case of an intermittent (e.g. dial-on-demand)  
connection to the network where your NTP servers are.  
endef  
 
define Package/chrony/conffiles  
/etc/chrony/chrony.conf  
endef  
 
define Build/Configure  
$(call Build/Configure/Default, \  
--target=$(GNU_TARGET_NAME) \  
--prefix=/usr \  
--with-readline-includes=$(STAGING_DIR)/usr/include \  
--with-readline-library=$(STAGING_DIR)/usr/lib \  
--disable-linuxcaps \  
)  
endef  
 
define Build/Compile  
$(MAKE) -C $(PKG_BUILD_DIR) \  
$(TARGET_CONFIGURE_OPTS) \  
prefix="$(PKG_INSTALL_DIR)/usr"  
endef  
 
define Package/chrony/install  
$(INSTALL_DIR) $(1)/usr/bin/  
$(INSTALL_DIR) $(1)/usr/sbin/  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyd $(1)/usr/sbin  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyc $(1)/usr/bin  
$(INSTALL_DIR) $(1)/etc/init.d  
$(INSTALL_DIR) $(1)/etc/config  
$(INSTALL_DIR) $(1)/etc/chrony  
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface  
$(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd  
$(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd  
$(INSTALL_CONF) ./files/ntpd.config $(1)/etc/config/ntpd  
$(INSTALL_CONF) ./files/chrony.conf $(1)/etc/chrony/chrony.conf  
$(INSTALL_CONF) ./files/chrony.keys $(1)/etc/chrony/chrony.keys  
endef  
 
$(eval $(call BuildPackage,chrony))  
 
# Chrony configuration  
 
# Note: time servers and ntp client access is configured in /etc/config/ntpd  
# and automatically set at startup  
 
# Log clock errors above 0.5 seconds  
logchange 0.5  
 
# Allow command access only from localhost  
cmdallow localhost  
cmddeny  
 
# Password config for chronyc  
# Note: Using a command key other than "1" will break  
# /etc/init.d/ntpd and /etc/hotplug.d/iface/20-ntpd  
keyfile /etc/chrony/chrony.keys  
commandkey 1  
 
1 chronyc  
 
# Generic NTP configuration  
# Time servers and network(s) that may access the time service  
 
config ntpd  
option TimeServers "0.openwrt.pool.ntp.org 1.openwrt.pool.ntp.org 2.openwrt.pool.ntp.org 3.openwrt.pool.ntp.org"  
option ClientAccessFrom "lan"  
 
COMMAND=/usr/bin/chronyc  
CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)  
 
chrony_control() {  
$COMMAND << EOF  
password $CHRONY_KEY  
$1  
EOF  
}  
 
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {  
[ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{  
chrony_control online  
}  
}  
 
[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {  
[ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{  
chrony_control offline  
}  
}  
 
#!/bin/sh /etc/rc.common  
# Copyright (C) 2006 OpenWrt.org  
 
START=60  
 
start() {  
[ ! -f /var/run/chronyd.pid ] && (  
/usr/sbin/chronyd -f /etc/chrony/chrony.conf  
 
local NTP_SERVERS  
local NTP_SERVER  
local CLIENT_NETWORKS  
local NETNAME  
config_load ntpd  
config_get NTP_SERVERS $CONFIG_SECTION TimeServers  
config_get CLIENT_NETWORKS $CONFIG_SECTION ClientAccessFrom  
CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)  
 
. /lib/functions/network.sh  
 
# Define servers and do a rapid series of time measurements  
# to get up to date  
(  
echo password $CHRONY_KEY  
for NTP_SERVER in $NTP_SERVERS; do  
echo add server $NTP_SERVER  
done  
echo burst 5/5  
) | chronyc > /dev/null 2>&1  
# ... wait until a reference ID is found ...  
while chronyc tracking | grep 'Reference ID.*0.0.0.0' >/dev/null ; do sleep 1; done  
# ... and finally, adjust the time in a single step  
# and allow clients to access the server  
(  
echo password $CHRONY_KEY  
echo makestep  
for NETNAME in $CLIENT_NETWORKS; do  
local subnet  
if network_get_subnet subnet "$NETNAME"; then  
echo allow $subnet  
fi  
done  
) | chronyc > /dev/null 2>&1  
)  
}  
 
stop() {  
[ -r /var/run/chronyd.pid ] && PID=$(cat /var/run/chronyd.pid)  
[ -n "$PID" ] && kill $PID  
}  
 
restart() {  
stop  
while [ -r /var/run/chronyd.pid ] ; do sleep 1; done  
start  
}  
 
--- a/configure  
+++ b/configure  
@@ -254,6 +254,13 @@ do  
--host-machine=* )  
MACHINE=`echo $option | sed -e 's/^.*=//;'`  
;;  
+ --target=* )  
+ TARGET=`echo $option | sed -e 's/[^=]*=//;'`  
+ OPERATINGSYSTEM=`echo $TARGET | sed -e 's/.*-//;'`  
+ MACHINE=`echo $TARGET | sed -e 's/-.*//;'`  
+ VERSION=""  
+ SYSTEM=${OPERATINGSYSTEM}-${MACHINE}  
+ ;;  
--help | -h )  
usage  
exit 0  
@@ -287,7 +294,7 @@ case $SYSTEM in  
;;  
esac  
;;  
- Linux* )  
+ Linux* | linux* )  
EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o"  
try_linuxcaps=1  
try_rtc=1  
 
--- a/ntp_io.c  
+++ b/ntp_io.c  
@@ -355,6 +355,7 @@ read_from_socket(void *anything)  
}  
#endif  
 
+#ifdef HAVE_IPV6  
#ifdef IPV6_PKTINFO  
if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {  
struct in6_pktinfo ipi;  
@@ -365,6 +366,7 @@ read_from_socket(void *anything)  
remote_addr.local_ip_addr.family = IPADDR_INET6;  
}  
#endif  
+#endif  
 
#ifdef SO_TIMESTAMP  
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SO_TIMESTAMP) {  
@@ -466,6 +468,7 @@ send_packet(void *packet, int packetlen,  
}  
#endif  
 
+#ifdef HAVE_IPV6  
#ifdef IPV6_PKTINFO  
if (remote_addr->local_ip_addr.family == IPADDR_INET6) {  
struct cmsghdr *cmsg;  
@@ -484,6 +487,7 @@ send_packet(void *packet, int packetlen,  
sizeof(ipi->ipi6_addr.s6_addr));  
}  
#endif  
+#endif  
 
#if 0  
LOG(LOGS_INFO, LOGF_NtpIO, "sending to %s:%d from %s",  
 
comments