chrony/chrony.spec

258 lines
8.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package chrony
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define vendorzone opensuse.
Accepting request 528207 from home:markkp:branches:network:time - Upgraded to version 3.2: Enhancements * Improve stability with NTP sources and reference clocks * Improve stability with hardware timestamping * Improve support for NTP interleaved modes * Control frequency of system clock on macOS 10.13 and later * Set TAI-UTC offset of system clock with leapsectz directive * Minimise data in client requests to improve privacy * Allow transmit-only hardware timestamping * Add support for new timestamping options introduced in Linux 4.13 * Add root delay, root dispersion and maximum error to tracking log * Add mindelay and asymmetry options to server/peer/pool directive * Add extpps option to PHC refclock to timestamp external PPS signal * Add pps option to refclock directive to treat any refclock as PPS * Add width option to refclock directive to filter wrong pulse edges * Add rxfilter option to hwtimestamp directive * Add -x option to disable control of system clock * Add -l option to log to specified file instead of syslog * Allow multiple command-line options to be specified together * Allow starting without root privileges with -Q option * Update seccomp filter for new glibc versions * Dump history on exit by default with dumpdir directive * Use hardening compiler options by default Bug fixes * Don't drop PHC samples with low-resolution system clock * Ignore outliers in PHC tracking, RTC tracking, manual input * Increase polling interval when peer is not responding * Exit with error message when include directive fails * Don't allow slash after hostname in allow/deny directive/command * Try to connect to all addresses in chronyc before giving up - Upgraded clknetsim to version 71dbbc5. - Reworked chrony-fix-open.patch to fit the new version OBS-URL: https://build.opensuse.org/request/show/528207 OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=29
2017-09-22 09:52:47 +02:00
%global clknetsim_ver 71dbbc5
%if 0%{?suse_version} > 1230
%bcond_without systemd
%bcond_without syscallfilter
%else
%bcond_with systemd
%bcond_with syscallfilter
%endif
# If is_opensuse is not defined, then this is an older version of SLES
# or some other distribution. So, if not defined then define it as 0
%if 0%{!?is_opensuse:%global is_opensuse 0}
%endif
Name: chrony
Accepting request 528207 from home:markkp:branches:network:time - Upgraded to version 3.2: Enhancements * Improve stability with NTP sources and reference clocks * Improve stability with hardware timestamping * Improve support for NTP interleaved modes * Control frequency of system clock on macOS 10.13 and later * Set TAI-UTC offset of system clock with leapsectz directive * Minimise data in client requests to improve privacy * Allow transmit-only hardware timestamping * Add support for new timestamping options introduced in Linux 4.13 * Add root delay, root dispersion and maximum error to tracking log * Add mindelay and asymmetry options to server/peer/pool directive * Add extpps option to PHC refclock to timestamp external PPS signal * Add pps option to refclock directive to treat any refclock as PPS * Add width option to refclock directive to filter wrong pulse edges * Add rxfilter option to hwtimestamp directive * Add -x option to disable control of system clock * Add -l option to log to specified file instead of syslog * Allow multiple command-line options to be specified together * Allow starting without root privileges with -Q option * Update seccomp filter for new glibc versions * Dump history on exit by default with dumpdir directive * Use hardening compiler options by default Bug fixes * Don't drop PHC samples with low-resolution system clock * Ignore outliers in PHC tracking, RTC tracking, manual input * Increase polling interval when peer is not responding * Exit with error message when include directive fails * Don't allow slash after hostname in allow/deny directive/command * Try to connect to all addresses in chronyc before giving up - Upgraded clknetsim to version 71dbbc5. - Reworked chrony-fix-open.patch to fit the new version OBS-URL: https://build.opensuse.org/request/show/528207 OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=29
2017-09-22 09:52:47 +02:00
Version: 3.2
Release: 0
Summary: System Clock Synchronization Client and Server
License: GPL-2.0
Group: Productivity/Networking/Other
Url: http://chrony.tuxfamily.org/
Source: http://download.tuxfamily.org/chrony/chrony-%{version}.tar.gz
Source1: chrony.init
Source2: chrony.sysconfig
Source3: chrony.dhclient
Source4: chrony.helper
Source5: chrony-dnssrv@.service
Source6: chrony-dnssrv@.timer
# Simulator for test suite
Source10: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0: chrony-config.patch
# Add NTP servers from DHCP when starting service
Patch1: chrony-service-helper.patch
Patch2: chrony-logrotate.patch
Patch5: chrony-fix-open.patch
#
BuildRequires: NetworkManager-devel
BuildRequires: bison
BuildRequires: gcc-c++
BuildRequires: libcap-devel
BuildRequires: libedit-devel
BuildRequires: mozilla-nss-devel
BuildRequires: pkgconfig
# The timezone package is needed for the "make check" tests. It can be
# removed if the call to make check is ever deleted.
BuildRequires: timezone
Requires: logrotate
Requires(pre): %fillup_prereq
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Provides: ntp-daemon
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with syscallfilter}
%ifarch s390 s390x ppc64le
BuildRequires: libseccomp-devel >= 2.2.0
%else
BuildRequires: libseccomp-devel
%endif
%endif
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
%description
Chrony is an implementation of the Network Time Protocol (NTP). It can
synchronize the system clock with NTP servers, reference clocks (e.g. a
GPS receiver), and manual input using wristwatch and keyboard. It can
also operate as an NTPv4 (RFC 5905) server and peer to provide a time
service to other computers in the network.
Chrony consists of two programs: chronyd and chronyc.
Chronyd is a daemon which runs in the background on the system. It
obtains measurements of the system clocks offset relative to time
servers on other systems via the network and adjusts the system time
accordingly. For isolated systems, the user can periodically enter the
correct time by hand (using chronyc). In either case, chronyd
determines the rate at which the computer gains or loses time, and
compensates for this. Chronyd can act as either a client or a server.
Chronyc provides a user interface to chronyd for monitoring its
performance and configuring various settings. It can do so while
running on the same computer as the chronyd instance it is controlling
or a different computer.
%prep
%setup -q -a 10
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch5 -p1
# If this is an openSUSE build, use our vendor zone
# (2.*pool.ntp.org names include IPv6 addresses). If not
# an openSUSE build, comment out the pool statement
%if %{is_opensuse}
sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \
< examples/chrony.conf.example2 > chrony.conf
%else
sed -e 's|^\pool|! pool|' \
< examples/chrony.conf.example2 > chrony.conf
%endif
touch -r examples/chrony.conf.example2 chrony.conf
# regenerate the file from getdate.y
rm -f getdate.c
mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim
%build
# not autoconf:
export CFLAGS="%{optflags} -Wall -fpic -DPIC $(pkg-config --cflags libseccomp)"
export LDFLAGS="-pie -Wl,-z,relro,-z,now"
%configure \
--docdir="%{_docdir}/%{name}" \
%if %{with syscallfilter}
--enable-scfilter \
%endif
--with-user=chrony \
--with-hwclockfile=%{_sysconfdir}/adjtime \
--with-sendmail=%{_sbindir}/sendmail
make %{?_smp_mflags} all docs
%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_sysconfdir}/{sysconfig,logrotate.d}
mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/chrony
mkdir -p %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d
mkdir -p %{buildroot}%{_sysconfdir}/dhcp/dhclient.d
mkdir -p %{buildroot}%{_datadir}
mkdir -p %{buildroot}{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d}
install -m 644 -p chrony.conf %{buildroot}%{_sysconfdir}/chrony.conf
install -m 640 -p examples/chrony.keys.example \
%{buildroot}%{_sysconfdir}/chrony.keys
install -m 755 -p examples/chrony.nm-dispatcher \
%{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
install -m 755 -p %{SOURCE3} \
%{buildroot}%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
install -m 644 -p examples/chrony.logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/chrony
%if %{with systemd}
install -m 644 -p examples/chronyd.service \
%{buildroot}%{_unitdir}/chronyd.service
install -m 644 -p examples/chrony-wait.service \
%{buildroot}%{_unitdir}/chrony-wait.service
install -m 644 -p %{SOURCE5} %{buildroot}%{_unitdir}/chrony-dnssrv@.service
install -m 644 -p %{SOURCE6} %{buildroot}%{_unitdir}/chrony-dnssrv@.timer
ln -s %{_sbindir}/service "%{buildroot}%{_sbindir}/rcchronyd"
ln -s %{_sbindir}/service "%{buildroot}%{_sbindir}/rcchrony-wait"
echo 'chronyd.service' > \
%{buildroot}%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list
%else
install -D -m0755 "%{SOURCE1}" "%{buildroot}%{_initddir}/chronyd"
ln -s ../..%{_initddir}/chronyd "%{buildroot}%{_sbindir}/rcchronyd"
%endif
install -D -m0644 "%{SOURCE2}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.chronyd"
install -m 755 -p %{SOURCE4} %{buildroot}%{_datadir}/chrony-helper
touch %{buildroot}%{_localstatedir}/lib/chrony/{drift,rtc}
%check
# Set random seed to get deterministic results
export CLKNETSIM_RANDOM_SEED=24501
make %{?_smp_mflags} -C test/simulation/clknetsim
make check
%pre
%{_sbindir}/groupadd -r chrony >/dev/null 2>&1 || :
%{_sbindir}/useradd -g chrony -s /bin/false -r -c "Chrony Daemon" -d "%{_localstatedir}/lib/chrony" chrony >/dev/null 2>&1 || :
# START BIG SYSTEMD
%if %{with systemd}
%service_add_pre chronyd.service chrony-wait.service
%endif
%preun
%if %{with systemd}
%service_del_preun chronyd.service chrony-wait.service
%else
%stop_on_removal chronyd
%endif
%post
%fillup_only %{name}
%if %{with systemd}
%service_add_post chronyd.service chrony-wait.service
%endif
%postun
%if %{with systemd}
%service_del_postun chronyd.service chrony-wait.service
%else
%restart_on_update chronyd
%insserv_cleanup
%endif
%files
%defattr(-,root,root)
%doc FAQ NEWS README COPYING
%doc examples
%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/chrony.conf
%config(noreplace) %attr(0640,root,%{name}) %verify(not md5 size mtime) %{_sysconfdir}/chrony.keys
%config(noreplace) %{_sysconfdir}/logrotate.d/chrony
%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
%dir %{_sysconfdir}/dhcp/
%dir %{_sysconfdir}/dhcp/dhclient.d/
%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
%{_bindir}/chronyc
%{_sbindir}/chronyd
%{_datadir}/chrony-helper
%{_mandir}/man1/chronyc.1%{ext_man}
%{_mandir}/man5/chrony.conf.5%{ext_man}
%{_mandir}/man8/chronyd.8%{ext_man}
%if %{with systemd}
%{_prefix}/lib/systemd/ntp-units.d/*.list
%{_unitdir}/chrony*.service
%{_unitdir}/chrony*.timer
%else
%config %{_sysconfdir}/init.d/chronyd
%endif
%{_sbindir}/rcchrony*
%{_localstatedir}/adm/fillup-templates/sysconfig.chronyd
%dir %attr(750,chrony,chrony) %{_localstatedir}/lib/chrony
%ghost %attr(640,chrony,chrony) %{_localstatedir}/lib/chrony/drift
%ghost %attr(640,chrony,chrony) %{_localstatedir}/lib/chrony/rtc
%dir %attr(750,chrony,chrony) %{_localstatedir}/log/chrony
%changelog