- update to 20100428git73d775

- replace initstepslew directive with makestep in default config
- add NetworkManager dispatcher script
- add dhclient script
- retry server/peer name resolution at least once to workaround
    NetworkManager race condition on boot
- don't verify chrony.keys
This commit is contained in:
Miroslav Lichvar 2010-04-29 13:50:56 +00:00
parent c6b186a09e
commit 09dcbbacfb
8 changed files with 101 additions and 10 deletions

View File

@ -1,3 +1,3 @@
chrony-1.24.tar.gz
chrony-1.24-git5fb555.patch.gz
timepps.h
chrony-1.24-20100428git73d775.patch.gz

12
chrony-retryres.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up chrony-1.24/cmdparse.c.retryres chrony-1.24/cmdparse.c
--- chrony-1.24/cmdparse.c.retryres 2010-04-29 15:22:23.000000000 +0200
+++ chrony-1.24/cmdparse.c 2010-04-29 15:24:47.000000000 +0200
@@ -68,7 +68,7 @@ CPS_ParseNTPSourceAdd(const char *line,
if (s == DNS_Success) {
ok = 1;
src->name = NULL;
- } else if (s == DNS_TryAgain) {
+ } else {
ok = 1;
src->ip_addr.family = IPADDR_UNSPEC;
}

View File

@ -3,10 +3,13 @@
server 0.fedora.pool.ntp.org
server 1.fedora.pool.ntp.org
server 2.fedora.pool.ntp.org
initstepslew 100 0.fedora.pool.ntp.org 1.fedora.pool.ntp.org 2.fedora.pool.ntp.org
driftfile /var/lib/chrony/drift
# In first three updates step the system clock instead of slew
# if the adjustment is larger than 100 seconds.
makestep 100 3
# Allow client access from local network.
#allow 192.168/16
@ -21,8 +24,7 @@ commandkey 1
# Disable logging of client accesses.
noclientlog
# Send a message to syslog when chronyd has to correct
# an error larger than 0.5 seconds.
# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.
logchange 0.5
logdir /var/log/chrony

24
chrony.dhclient Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
SERVERFILE=$SAVEDIR/chrony.servers.$interface
chrony_config() {
rm -f $SERVERFILE
if [ "$PEERNTP" != "no" ]; then
/etc/init.d/chronyd command "$(
for server in $new_ntp_servers; do
echo "add server $server $NTPSERVERARGS"
echo "$server $NTPSERVERARGS" >> $SERVERFILE
done)" &> /dev/null
fi
}
chrony_restore() {
if [ -f $SERVERFILE ]; then
/etc/init.d/chronyd command "$(
while read server serverargs; do
echo "delete $server"
done < $SERVERFILE)" &> /dev/null
rm -f $SERVERFILE
fi
}

15
chrony.nm-dispatcher Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
export LC_ALL=C
if [ "$2" = "up" ]; then
/sbin/ip route list dev "$1" | grep -q '^default' &&
/etc/init.d/chronyd online
fi
if [ "$2" = "down" ]; then
/sbin/ip route list | grep -q '^default' ||
/etc/init.d/chronyd offline
fi
exit 0

View File

@ -1,6 +1,7 @@
%define gitpatch 20100428git73d775
Name: chrony
Version: 1.24
Release: 3.20100302git5fb555%{?dist}
Release: 4.%{?gitpatch}%{?dist}
Summary: An NTP client/server
Group: System Environment/Daemons
@ -14,7 +15,10 @@ Source4: chronyd.init
Source5: chrony.logrotate
# wget -O timepps.h 'http://gitweb.enneenne.com/?p=linuxpps;a=blob_plain;f=Documentation/pps/timepps.h;hb=b895b1a28558b83907c691aad231c41a0d14df88'
Source6: timepps.h
Patch0: chrony-1.24-git5fb555.patch.gz
Source7: chrony.nm-dispatcher
Source8: chrony.dhclient
Patch0: chrony-%{version}-%{gitpatch}.patch.gz
Patch1: chrony-retryres.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libcap-devel libedit-devel bison texinfo
@ -34,6 +38,9 @@ in permanently connected environments.
%setup -q -n %{name}-%{version}%{?prerelease}
mkdir pps; cp -p %{SOURCE6} pps
%patch0 -p1
%patch1 -p1 -b .retryres
%{?gitpatch: echo %{version}-%{gitpatch} > version.txt}
%build
CFLAGS="$RPM_OPT_FLAGS"
@ -57,12 +64,18 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/{sysconfig,logrotate.d},%{_initrddir}}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/{lib,log}/chrony
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d
install -m 644 -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/chrony.conf
install -m 640 -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/chrony.keys
install -m 644 -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/chronyd
install -m 755 -p %{SOURCE4} $RPM_BUILD_ROOT%{_initrddir}/chronyd
install -m 644 -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/chrony
install -m 755 -p %{SOURCE7} \
$RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
install -m 755 -p %{SOURCE8} \
$RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc}
@ -98,9 +111,11 @@ fi
%defattr(-,root,root,-)
%doc COPYING NEWS README chrony.txt faq.txt examples/*
%config(noreplace) %{_sysconfdir}/chrony.conf
%config(noreplace) %attr(640,root,chrony) %{_sysconfdir}/chrony.keys
%config(noreplace) %verify(not md5 size mtime) %attr(640,root,chrony) %{_sysconfdir}/chrony.keys
%config(noreplace) %{_sysconfdir}/sysconfig/chronyd
%config(noreplace) %{_sysconfdir}/logrotate.d/chrony
%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
%{_initrddir}/chronyd
%{_bindir}/chronyc
%{_sbindir}/chronyd
@ -112,6 +127,15 @@ fi
%dir %attr(-,chrony,chrony) %{_localstatedir}/log/chrony
%changelog
* Thu Apr 29 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-4.20100428git73d775
- update to 20100428git73d775
- replace initstepslew directive with makestep in default config
- add NetworkManager dispatcher script
- add dhclient script
- retry server/peer name resolution at least once to workaround
NetworkManager race condition on boot
- don't verify chrony.keys
* Fri Mar 12 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-3.20100302git5fb555
- update to snapshot 20100302git5fb555
- compile with PPS API support

View File

@ -28,6 +28,7 @@ prog=chronyd
config=/etc/chrony.conf
keyfile=/etc/chrony.keys
chronyc=/usr/bin/chronyc
dhclient_servers=/var/lib/dhclient/chrony.servers.*
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
@ -54,8 +55,8 @@ $1
EOF
chronycpid=$!
# chronyc will hang if the daemon doesn't respond, kill it after 3 s
(sleep 3; kill $chronycpid) < /dev/null &> /dev/null &
# chronyc will hang if the daemon doesn't respond, kill it after 4 s
(sleep 4; kill $chronycpid) < /dev/null &> /dev/null &
killerpid=$!
wait $chronycpid &> /dev/null
@ -76,6 +77,18 @@ generate_commandkey() {
echo
}
add_dhclient_servers() {
command=$(cat $dhclient_servers 2> /dev/null |
while read server serverargs; do
echo "add server $server $serverargs"
done)
if [ -n "$command" ]; then
echo -n $"Adding dhclient NTP servers to chrony: "
chrony_command "$command" &> /dev/null && success || failure
echo
fi
}
start() {
[ "$NETWORKING" = "no" ] && exit 1
[ -x $exec ] || exit 5
@ -86,6 +99,7 @@ start() {
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
[ $retval -eq 0 ] && add_dhclient_servers
return $retval
}

View File

@ -1,3 +1,3 @@
8849e95428f43c5ab2692a2812653e65 chrony-1.24.tar.gz
96be74d903008f7322e84229df28a0a7 chrony-1.24-git5fb555.patch.gz
b494eddf72f3455c333eed80642dc20d timepps.h
fd084bd4bf10c8fb4208d2a582177dc1 chrony-1.24-20100428git73d775.patch.gz