2 # - enable and package ntpdsim?
3 # - net-snmp-ntpd needs initscript
5 # - update man pages (from Debian?)
8 %bcond_without avahi # disable DNS-SD support via Avahi
9 %bcond_without sntp # disable building sntp and sntp/tests
10 %bcond_with seccomp # enable experimental support for libseccomp sandboxing
12 %include /usr/lib/rpm/macros.perl
13 Summary: Network Time Protocol utilities
14 Summary(pl.UTF-8): Narzędzia do synchronizacji czasu (Network Time Protocol)
15 Summary(pt_BR.UTF-8): Network Time Protocol versão 4
19 License: distributable
20 Group: Networking/Daemons
21 Source0: https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
22 # Source0-md5: 1522d66574bae14abb2622746dad2bdc
25 Source3: %{name}d.init
26 Source4: %{name}d.sysconfig
27 Source5: %{name}date.init
28 Source6: %{name}date.sysconfig
29 Source7: %{name}-manpages.tar.gz
30 # Source7-md5: 208fcc9019e19ab26d28e4597290bffb
31 Source10: %{name}date-wrapper
32 Source11: %{name}d.service
33 Source12: %{name}date.service
34 Source13: https://www.ietf.org/timezones/data/leap-seconds.list
35 # Source13-md5: 52518f58e3513167fdc00e3fb0062825
36 Patch0: %{name}-build.patch
37 Patch1: %{name}-no_libelf.patch
38 Patch2: %{name}-ipv6.patch
39 Patch3: %{name}-nano.patch
41 Patch101: %{name}-4.2.6p1-sleep.patch
42 Patch102: %{name}-4.2.6p1-droproot.patch
43 Patch103: %{name}-4.2.6p1-bcast.patch
44 Patch104: %{name}-4.2.6p1-cmsgalign.patch
45 Patch105: %{name}-4.2.6p1-linkfastmath.patch
46 Patch107: %{name}-4.2.6p1-retcode.patch
47 Patch108: %{name}-4.2.6p1-rtnetlink.patch
48 Patch110: %{name}-logdefault.patch
49 Patch111: %{name}-4.2.6p1-mlock.patch
50 URL: http://www.ntp.org/
51 BuildRequires: autoconf >= 2.61
52 BuildRequires: autogen-devel >= 5.18.12
53 BuildRequires: automake >= 1:1.10
54 %{?with_avahi:BuildRequires: avahi-compat-libdns_sd-devel}
55 BuildRequires: libcap-devel
56 %{?with_sntp:BuildRequires: libevent-devel >= 2.0}
57 BuildRequires: libnl-devel
58 %{?with_seccomp:BuildRequires: libseccomp-devel}
59 BuildRequires: libtool
60 BuildRequires: net-snmp-devel
61 BuildRequires: openssl-devel >= 0.9.7d
62 BuildRequires: pciutils-devel
63 # AUTO: -- checking for pkg-config... no
64 BuildRequires: pkgconfig
65 BuildRequires: readline-devel >= 4.2
66 BuildRequires: rpm-perlprov >= 4.1-13
67 BuildRequires: rpmbuild(macros) >= 1.626
68 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70 %define _sysconfdir /etc/ntp
71 %define _bindir %{_sbindir}
72 %define mibdir %{_datadir}/mibs
75 The Network Time Protocol (NTP) is used to synchronize a computer's
76 time with another reference time source. The ntp package contains
77 utilities and daemons which will synchronize your computer's time to
78 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
80 %description -l pl.UTF-8
81 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
82 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
83 służące do dokładnego synchronizowania czasu komputera według czasu
84 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
86 %description -l pt_BR.UTF-8
87 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
88 utilizado para sincronizar o relógio do computador com uma outra
89 referência de horário. Este pacote contém utilitários e servidores que
90 sincronizarão o relógio do seu computador com o horário universal
91 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
93 Instale o pacote ntp se você necessitar de ferramentas para manter o
94 relógio do seu computador constantemente atualizado.
97 Summary: The NTP daemon
98 Summary(pl.UTF-8): Narzędzia do synchronizacji czasu (Network Time Protocol)
99 Summary(pt_BR.UTF-8): Network Time Protocol versão 4
101 Requires(post,preun): /sbin/chkconfig
102 Requires(postun): /usr/sbin/groupdel
103 Requires(postun): /usr/sbin/userdel
104 Requires(pre): /bin/id
105 Requires(pre): /usr/bin/getgid
106 Requires(pre): /usr/sbin/groupadd
107 Requires(pre): /usr/sbin/useradd
108 Requires(post,preun,postun): systemd-units >= 38
109 %requires_ge autogen-libs
111 Requires: rc-scripts >= 0.4.3.0
112 Requires: systemd-units >= 38
114 Provides: ntp = %{version}-%{release}
117 Obsoletes: ntp < 4.2.4p8-6
123 The Network Time Protocol (NTP) is used to synchronize a computer's
124 time with another reference time source. The ntp package contains
125 utilities and daemons which will synchronize your computer's time to
126 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
128 This package includes ntpd (a daemon which continuously adjusts system
131 %description -n ntpd -l pl.UTF-8
132 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
133 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
134 służące do dokładnego synchronizowania czasu komputera według czasu
135 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
137 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
140 %description -n ntpd -l pt_BR.UTF-8
141 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
142 utilizado para sincronizar o relógio do computador com uma outra
143 referência de horário. Este pacote contém utilitários e servidores que
144 sincronizarão o relógio do seu computador com o horário universal
145 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
148 Summary: Utility to set the date and time via NTP
149 Summary(pl.UTF-8): Klient do synchronizacji czasu po NTP (Network Time Protocol)
150 Group: Applications/Networking
151 Requires(post,preun): /sbin/chkconfig
152 Requires(postun): /usr/sbin/groupdel
153 Requires(postun): /usr/sbin/userdel
154 Requires(pre): /bin/id
155 Requires(pre): /usr/bin/getgid
156 Requires(pre): /usr/sbin/groupadd
157 Requires(pre): /usr/sbin/useradd
158 Requires(post,preun,postun): systemd-units >= 38
159 Requires: rc-scripts >= 0.4.3.0
160 Requires: systemd-units >= 38
163 Conflicts: ntp < 4.2.0-3
165 Provides: ntp-client = %{version}-%{release}
166 Obsoletes: ntp-client < 4.2.4p8-6
171 %description -n ntpdate
172 ntpdate is a program for retrieving the date and time from NTP
175 %description -n ntpdate -l pl.UTF-8
176 Klient do synchronizacji czasu po NTP (Network Time Protocol).
179 Summary: MIBs for NTP time entities
180 Summary(pl.UTF-8): Pliki MIB dla elementów czasu NTP
181 Group: Applications/System
183 %if "%{_rpmversion}" >= "5"
187 %description -n mibs-ntp
188 The Management Information Base for NTP time entities.
190 %description -n mibs-ntp -l pl.UTF-8
191 Pliki MIB (Management Information Base) dla elementów czasu NTP
193 %package -n net-snmp-ntpd
194 Summary: NTP SNMP subagent for Net-SNMP
195 Summary(pl.UTF-8): Podagent SNMP NTP dla usługi Net-SNMP
197 Requires(post,preun): /sbin/chkconfig
202 %description -n net-snmp-ntpd
203 NTP SNMP AgentX subagent for Net-SNMP.
205 %description -n net-snmp-ntpd -l pl.UTF-8
206 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
210 Summary(pl.UTF-8): Narzędzia NTP
211 Group: Applications/Networking
212 Obsoletes: ntp-ntptrace
215 This package contains NTP tools:
216 - ntptrace: Trace a chain of NTP servers back to the primary source
217 - ntp-wait: Wait for NTP server to synchronize
218 - calc_tickadj: Calculate optimal value for tick given ntp drift file
220 %description tools -l pl.UTF-8
221 Ten pakiet zawiera narzędzia NTP:
222 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
223 - ntp-wait: oczekiwanie na synchronizację serwera NTP
224 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
227 Summary: HTML documentation for ntp
228 Summary(pl.UTF-8): Dokumentacja HTML dla ntp
229 Summary(pt_BR.UTF-8): Documentação adicional para o pacote ntp
231 %if "%{_rpmversion}" >= "5"
235 %description doc-html
236 HTML documentation for ntp.
238 %description doc-html -l pl.UTF-8
239 Dokumentacja do ntp w HTML.
241 %description doc-html -l pt_BR.UTF-8
242 Este pacote contém documentação adicional sobre o NTP versão 4.
260 #%patch111 -p1 -- obsolete?
262 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
263 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
265 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
269 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
274 %{__aclocal} -I m4 -I libopts/m4 -I libevent/m4
284 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
286 --disable-silent-rules \
287 --with-binsubdir=sbin \
289 --enable-getifaddrs \
290 %{?with_seccomp:--enable-libseccomp} \
291 %{__with_without sntp} \
294 --with-lineeditlibs=readline \
295 --with-crypto=openssl \
296 --disable-local-libopts \
297 --disable-local-libevent
302 rm -rf $RPM_BUILD_ROOT
303 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
304 $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
305 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly}
308 DESTDIR=$RPM_BUILD_ROOT
310 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
311 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
312 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.leapseconds
314 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
315 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
316 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
317 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
319 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
320 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
321 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
322 echo 'ntpd.service' > \
323 $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
325 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
327 install -d $RPM_BUILD_ROOT/var/lib/ntp
328 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
330 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
332 # Source function library.
333 . /etc/rc.d/init.d/functions
335 # Source ntpdate configuration
336 . /etc/sysconfig/ntpdate
338 is_yes "$NTPDATE_CRON" || exit 0
339 exec %{_sbindir}/ntpdate-wrapper
342 install -d $RPM_BUILD_ROOT%{mibdir}
343 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
345 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp,sntp}
348 rm -rf $RPM_BUILD_ROOT
352 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
355 /sbin/chkconfig --add ntpd
356 %service ntpd restart "NTP Daemon"
357 %systemd_post ntpd.service
360 if [ "$1" = "0" ]; then
362 /sbin/chkconfig --del ntpd
363 rm -f /var/lib/ntp/drift
365 %systemd_preun ntpd.service
368 if [ "$1" = "0" ]; then
376 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
379 /sbin/chkconfig --add ntpdate
380 %service ntpdate restart "NTP Date"
381 %systemd_post ntpdate.service
384 if [ "$1" = "0" ]; then
385 %service ntpdate stop
386 /sbin/chkconfig --del ntpdate
388 %systemd_preun ntpdate.service
391 if [ "$1" = "0" ]; then
397 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
398 # Prevent preun from ntp from working
399 chmod a-x /etc/rc.d/init.d/ntpd
401 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
402 # Restore what triggerun removed
403 chmod 754 /etc/rc.d/init.d/ntpd
404 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
405 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
406 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
407 %service -q ntpd restart
408 %systemd_trigger ntpd.service
409 %systemd_post ntpdate
411 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
412 %systemd_trigger ntpd.service
414 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
415 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
416 cp -f /etc/sysconfig/ntpdate{,.rpmnew}
417 mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
419 %systemd_trigger ntpdate.service
421 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
422 %systemd_trigger ntpdate.service
425 %defattr(644,root,root,755)
426 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
427 %attr(750,root,root) %dir %{_sysconfdir}
428 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/keys
429 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.conf
430 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.leapseconds
431 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
432 %attr(754,root,root) /etc/rc.d/init.d/ntpd
433 %{systemdunitdir}/ntpd.service
434 # dir not handled by systemd in pld
435 #%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
436 %attr(755,root,root) %{_sbindir}/ntpd
437 %attr(755,root,root) %{_sbindir}/ntpdc
438 %attr(755,root,root) %{_sbindir}/ntp-keygen
439 %attr(755,root,root) %{_sbindir}/ntpq
440 %attr(755,root,root) %{_sbindir}/ntptime
441 %attr(755,root,root) %{_sbindir}/sntp
442 %attr(755,root,root) %{_sbindir}/tickadj
443 %{_mandir}/man1/ntpd.1*
444 %{_mandir}/man1/ntpdc.1*
445 %{_mandir}/man1/ntp-keygen.1*
446 %{_mandir}/man1/ntpq.1*
447 %{_mandir}/man1/ntptime.1*
448 %{_mandir}/man1/sntp.1*
449 %{_mandir}/man5/ntp.conf.5*
450 %{_mandir}/man5/ntp.keys.5*
452 %dir %attr(770,root,ntp) /var/lib/ntp
453 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
456 %defattr(644,root,root,755)
458 %attr(755,root,root) %{_sbindir}/ntpdate
459 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
460 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
461 %attr(754,root,root) /etc/cron.hourly/ntpdate
462 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
463 %{systemdunitdir}/ntpdate.service
464 %{_mandir}/man1/ntpdate.1*
467 %defattr(644,root,root,755)
468 %{mibdir}/ntpv4-mib.mib
470 %files -n net-snmp-ntpd
471 %defattr(644,root,root,755)
473 %attr(755,root,root) %{_sbindir}/ntpsnmpd
474 %{_mandir}/man1/ntpsnmpd.1*
477 %defattr(644,root,root,755)
478 %attr(755,root,root) %{_sbindir}/calc_tickadj
479 %attr(755,root,root) %{_sbindir}/ntp-wait
480 %attr(755,root,root) %{_sbindir}/ntptrace
481 %attr(755,root,root) %{_sbindir}/update-leap
484 %{_mandir}/man1/calc_tickadj.1*
485 %{_mandir}/man1/ntp-wait.1*
486 %{_mandir}/man1/ntptrace.1*
487 %{_mandir}/man1/update-leap.1*
490 %defattr(644,root,root,755)