# # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22} %bcond_without systemd %bcond_without syscallfilter %else %bcond_with systemd %bcond_with syscallfilter %endif %define vendorzone opensuse. Name: chrony Version: 2.2 Release: 0 License: GPL-2.0+ Summary: System Clock Synchronization Client and Server Url: http://chrony.tuxfamily.org/ Group: Productivity/Networking/Other 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 # PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines Patch: chrony-config.patch # add NTP servers from DHCP when starting service Patch1: chrony-service-helper.patch Patch2: chrony-2.2_logrotate.patch # BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: NetworkManager-devel BuildRequires: bison BuildRequires: libcap-devel BuildRequires: libedit-devel %if %{with syscallfilter} %ifarch %{ix86} x86_64 %{arm} aarch64 BuildRequires: libseccomp-devel %endif %endif BuildRequires: mozilla-nss-devel BuildRequires: pkg-config BuildRequires: texinfo %if %{with systemd} BuildRequires: pkgconfig(systemd) %{?systemd_requires} %else Requires(pre): %insserv_prereq %endif Requires(pre): %fillup_prereq Requires(pre): %install_info_prereq Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd Requires: logrotate Recommends: timedatex %description Chrony is a pair of programs which are used to maintain the accuracy of the system clock on a computer. The two programs are called chronyd and chronyc. Chronyd is a daemon which runs in background on the system. It obtains measurements via the network of the system clock’s offset relative to time servers on other systems 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 implements the NTP protocol and 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 %patch -p1 %patch1 -p1 %patch2 -p1 # use our vendor zone (2.*pool.ntp.org names include IPv6 addresses) sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \ < examples/chrony.conf.example2 > chrony.conf touch -r examples/chrony.conf.example2 chrony.conf # regenerate the file from getdate.y rm -f getdate.c %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 gzip -9 -f -n chrony.txt %install %makeinstall install-docs rm -rf "%{buildroot}%{_docdir}/%{name}" 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 /sbin/service "%{buildroot}%{_sbindir}/rcchronyd" ln -s /sbin/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 ../../etc/init.d/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} %clean rm -rf %{buildroot} %pre /usr/sbin/groupadd -r chrony || : /usr/sbin/useradd -r -g chrony -c "Chrony Daemon" -d "%{_localstatedir}/lib/chrony" chrony || : # 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} %install_info --info-dir="%{_infodir}" "%{_infodir}/chrony.info%{ext_info}" %if %{with systemd} %service_add_post chronyd.service chrony-wait.service %endif %postun %install_info_delete --info-dir="%{_infodir}" "%{_infodir}/chrony.info%{ext_info}" %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 chrony.txt* 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} %{_infodir}/chrony.info* %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