use upstream configuration files and scripts

This commit is contained in:
Miroslav Lichvar 2014-09-11 12:07:05 +02:00
parent cc84193b06
commit 4ad5f0b6a1
8 changed files with 46 additions and 118 deletions

View File

@ -0,0 +1,11 @@
diff -up chrony-1.31/examples/chronyd.service.service-helper chrony-1.31/examples/chronyd.service
--- chrony-1.31/examples/chronyd.service.service-helper 2014-09-10 17:00:54.000000000 +0200
+++ chrony-1.31/examples/chronyd.service 2014-07-03 18:09:45.000000000 +0200
@@ -8,6 +8,7 @@ Type=forking
PIDFile=/var/run/chronyd.pid
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd $OPTIONS
+ExecStartPost=/usr/libexec/chrony-helper add-dhclient-servers
[Install]
WantedBy=multi-user.target

View File

@ -1,17 +0,0 @@
[Unit]
Description=Wait for chrony to synchronize system clock
After=chronyd.service
Requires=chronyd.service
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
# Wait up to ~10 minutes for chronyd to synchronize and the remaining
# clock correction to be less than 0.1 seconds
ExecStart=/usr/bin/chronyc waitsync 60 0.1
RemainAfterExit=yes
StandardOutput=null
[Install]
WantedBy=multi-user.target

View File

@ -1,46 +0,0 @@
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.VENDORZONE.pool.ntp.org iburst
server 1.VENDORZONE.pool.ntp.org iburst
server 2.VENDORZONE.pool.ntp.org iburst
server 3.VENDORZONE.pool.ntp.org iburst
# Ignore stratum in source selection.
stratumweight 0
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Enable kernel RTC synchronization.
rtcsync
# In first three updates step the system clock instead of slew
# if the adjustment is larger than 10 seconds.
makestep 10 3
# Allow NTP client access from local network.
#allow 192.168/16
# Listen for commands only on localhost.
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
# Serve time even if not synchronized to any NTP server.
#local stratum 10
keyfile /etc/chrony.keys
# Specify the key used as password for chronyc.
commandkey 1
# Generate command key if missing.
generatecommandkey
# Disable logging of client accesses.
noclientlog
# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.
logchange 0.5
logdir /var/log/chrony
#log measurements statistics tracking

View File

@ -1 +0,0 @@
#1 a_key

View File

@ -1,8 +0,0 @@
/var/log/chrony/*.log {
missingok
nocreate
sharedscripts
postrotate
/usr/bin/chronyc -a cyclelogs > /dev/null 2>&1 || true
endscript
}

View File

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

View File

@ -11,18 +11,15 @@ Group: System Environment/Daemons
License: GPLv2 License: GPLv2
URL: http://chrony.tuxfamily.org URL: http://chrony.tuxfamily.org
Source0: http://download.tuxfamily.org/chrony/chrony-%{version}%{?prerelease}.tar.gz Source0: http://download.tuxfamily.org/chrony/chrony-%{version}%{?prerelease}.tar.gz
Source1: chrony.conf Source1: chrony.dhclient
Source2: chrony.keys Source2: chrony.helper
Source3: chronyd.service
Source4: chrony.helper
Source5: chrony.logrotate
Source7: chrony.nm-dispatcher
Source8: chrony.dhclient
Source9: chrony-wait.service
# simulator for test suite from https://github.com/mlichvar/clknetsim.git # simulator for test suite from https://github.com/mlichvar/clknetsim.git
Source10: clknetsim-%{clknetsim_ver}.tar.gz Source10: clknetsim-%{clknetsim_ver}.tar.gz
%{?gitpatch:Patch0: chrony-%{version}%{?prerelease}-%{gitpatch}.patch.gz} %{?gitpatch:Patch0: chrony-%{version}%{?prerelease}-%{gitpatch}.patch.gz}
# add NTP servers from DHCP when starting service
Patch1: chrony-service-helper.patch
BuildRequires: libcap-devel libedit-devel nss-devel pps-tools-devel BuildRequires: libcap-devel libedit-devel nss-devel pps-tools-devel
BuildRequires: bison texinfo systemd-units BuildRequires: bison texinfo systemd-units
@ -46,11 +43,26 @@ clocks, system real-time clock or manual input as time references.
%prep %prep
%setup -q -n %{name}-%{version}%{?prerelease} -a 10 %setup -q -n %{name}-%{version}%{?prerelease} -a 10
%{?gitpatch:%patch0 -p1} %{?gitpatch:%patch0 -p1}
%patch1 -p1 -b .service-helper
%{?gitpatch: echo %{version}-%{gitpatch} > version.txt} %{?gitpatch: echo %{version}-%{gitpatch} > version.txt}
sed -e 's|VENDORZONE\.|%{vendorzone}|' < %{SOURCE1} > chrony.conf # review changes in packaged configuration files and scripts
touch -r %{SOURCE1} chrony.conf md5sum -c <<-EOF | (! grep -v 'OK$')
5cca89b571b0780481fc6f3c518e63bf examples/chrony-wait.service
d77c994ec12c247a5206e724cd70483d examples/chrony.conf.example2
2e9fe409a17de5d53a65f9869c4119f5 examples/chrony.logrotate
d7d323d0ea7ccc258710371ea79563d1 examples/chrony.nm-dispatcher
1a5122f7f40446596777a6c69431c415 examples/chronyd.service
EOF
# use our vendor zone
sed -e 's|\([0-3]\.\)\(pool.ntp.org\)|\1%{vendorzone}\2|' \
< examples/chrony.conf.example2 > chrony.conf
echo '# Keys used by chronyd for command and NTP authentication' > chrony.keys
touch -r examples/chrony.conf.example2 chrony.conf chrony.keys
# regenerate the file from getdate.y # regenerate the file from getdate.y
rm -f getdate.c rm -f getdate.c
@ -78,15 +90,21 @@ mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
mkdir -p $RPM_BUILD_ROOT{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d} mkdir -p $RPM_BUILD_ROOT{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d}
install -m 644 -p chrony.conf $RPM_BUILD_ROOT%{_sysconfdir}/chrony.conf install -m 644 -p chrony.conf $RPM_BUILD_ROOT%{_sysconfdir}/chrony.conf
install -m 640 -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/chrony.keys install -m 640 -p chrony.keys $RPM_BUILD_ROOT%{_sysconfdir}/chrony.keys
install -m 644 -p %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/chronyd.service
install -m 755 -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/chrony-helper install -m 755 -p examples/chrony.nm-dispatcher \
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 $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
install -m 755 -p %{SOURCE8} \ install -m 755 -p %{SOURCE1} \
$RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh $RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
install -m 644 -p %{SOURCE9} $RPM_BUILD_ROOT%{_unitdir}/chrony-wait.service install -m 644 -p examples/chrony.logrotate \
$RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/chrony
install -m 644 -p examples/chronyd.service \
$RPM_BUILD_ROOT%{_unitdir}/chronyd.service
install -m 644 -p examples/chrony-wait.service \
$RPM_BUILD_ROOT%{_unitdir}/chrony-wait.service
install -m 755 -p %{SOURCE2} $RPM_BUILD_ROOT%{_libexecdir}/chrony-helper
touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc} touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc}

View File

@ -1,14 +0,0 @@
[Unit]
Description=NTP client/server
After=ntpdate.service sntp.service ntpd.service
Conflicts=ntpd.service systemd-timesyncd.service
[Service]
Type=forking
PIDFile=/var/run/chronyd.pid
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd $OPTIONS
ExecStartPost=/usr/libexec/chrony-helper add-dhclient-servers
[Install]
WantedBy=multi-user.target