input/chrony.spec
raw · 4.9 KiB
%bcond_with tests
Name: chrony
Version: 4.8
Release: 2%{?dist}
Summary: NTP client/server for time synchronization
Summary(ru): Клиент/сервер NTP для синхронизации времени
License: GPL-2.0-only
URL: https://chrony.tuxfamily.org
Source0: https://chrony-project.org/releases/chrony-%{version}.tar.gz
Packager: NICE SOFT GROUP LLC (ООО "НАЙС СОФТ ГРУПП") 5024245440 <niceos@ncsgp.ru>
Vendor: NiceSOFT
Distribution: NiceOS.Core
BugURL: https://bugs.niceos.ru/
VCS: https://specs.niceos.ru/rpms/%{name}
BuildRequires: gcc
BuildRequires: make
BuildRequires: bison
BuildRequires: libcap-devel
BuildRequires: libseccomp-devel
BuildRequires: nettle-devel
BuildRequires: systemd
Requires: libcap
Requires: libseccomp
Requires: nettle
%{?systemd_requires}
%description
chrony is a versatile implementation of the Network Time Protocol (NTP). It can
synchronize the system clock with NTP servers, reference clocks (e.g. GPS), or
manual input, and it can also act as an NTPv4 (RFC 5905) server providing time
service to other computers on the network.
%description -l ru
chrony — это гибкая реализация протокола сетевого времени (NTP).
Она позволяет синхронизировать системные часы с NTP-серверами,
референсными часами (например, GPS-приёмником) или вручную через ввод
оператора. chrony также может работать как NTPv4 (RFC 5905) сервер и
обеспечивать службу времени для других компьютеров в сети.
%prep
%autosetup -p1
cp examples/chrony.conf.example2 chrony.conf
# RU: Перегенерируем файл getdate.c из getdate.y.
# EN: Regenerate getdate.c from getdate.y.
rm -f getdate.c
%build
%configure \
--enable-ntp-signd \
--enable-scfilter \
--docdir=%{_docdir}/%{name} \
--with-ntp-era=0
%make_build
%install
%make_install
mkdir -p %{buildroot}%{_sysconfdir}/{sysconfig,logrotate.d} \
%{buildroot}%{_localstatedir}/{lib,log}/chrony \
%{buildroot}{%{_unitdir},%{_libdir}/systemd/ntp-units.d} \
%{buildroot}%{_prefix}/lib/systemd/system-preset
install -m 0644 -p chrony.conf %{buildroot}%{_sysconfdir}/chrony.conf
install -m 0640 -p examples/chrony.keys.example \
%{buildroot}%{_sysconfdir}/chrony.keys
install -m 0644 -p examples/chrony.logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/chrony
install -m 0644 -p examples/chronyd.service \
%{buildroot}%{_unitdir}/chronyd.service
install -m 0644 -p examples/chrony-wait.service \
%{buildroot}%{_unitdir}/chrony-wait.service
cat > %{buildroot}%{_sysconfdir}/sysconfig/chronyd <<'EOF'
# Additional command-line options for chronyd
OPTIONS=""
EOF
cat > %{buildroot}%{_prefix}/lib/systemd/system-preset/40-chrony.preset <<'EOF'
# NiceOS default time synchronization policy.
#
# chronyd.service is enabled by default.
# chrony-wait.service is intentionally disabled by default because it delays
# boot until time synchronization is confirmed. Systems that require strict
# time-before-services semantics may enable it explicitly.
enable chronyd.service
disable chrony-wait.service
EOF
touch %{buildroot}%{_sharedstatedir}/chrony/{drift,rtc}
echo 'chronyd.service' > %{buildroot}%{_libdir}/systemd/ntp-units.d/50-chronyd.list
%check
%if %{with tests}
%make_build quickcheck
%endif
%post
%systemd_post chronyd.service chrony-wait.service
%preun
%systemd_preun chronyd.service chrony-wait.service
%postun
%systemd_postun_with_restart chronyd.service
%files
%defattr(-,root,root)
%license COPYING
%doc FAQ NEWS README
%config(noreplace) %{_sysconfdir}/chrony.conf
%config(noreplace) %verify(not md5 size mtime) %attr(0640,root,root) %{_sysconfdir}/chrony.keys
%config(noreplace) %{_sysconfdir}/logrotate.d/chrony
%config(noreplace) %{_sysconfdir}/sysconfig/chronyd
%{_bindir}/chronyc
%{_sbindir}/chronyd
%{_libdir}/systemd/ntp-units.d/*.list
%{_prefix}/lib/systemd/system-preset/40-chrony.preset
%{_unitdir}/chrony*.service
%{_mandir}/man[158]/%{name}*.[158]*
%dir %attr(-,root,root) %{_sharedstatedir}/chrony
%ghost %attr(-,root,root) %{_sharedstatedir}/chrony/drift
%ghost %attr(-,root,root) %{_sharedstatedir}/chrony/rtc
%dir %attr(-,root,root) %{_localstatedir}/log/chrony
%changelog
* Mon May 11 2026 ООО "НАЙС СОФТ ГРУПП" <niceos@ncsgp.ru> - 4.8-2
- Added NiceOS systemd preset for chrony.
- Enabled chronyd.service by default.
- Disabled chrony-wait.service by default to avoid delaying boot.
- Fixed VCS URL typo.
- Cleaned up install section and removed unused empty directories.
- Made NTP era configuration reproducible.
* Sun Jan 11 2026 NiceOS Team <niceos@ncsgp.ru> - 4.8-1
- Initial build for NiceOS (Первая сборка для НАЙС.ОС)