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: 4a8636260435b230636f053ffd070e34
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: http://www.ietf.org/timezones/data/leap-seconds.list
35 # Source13-md5: 2fcae06100fa9193a3e770c1b59bbbe1
36 Patch0: %{name}-build.patch
37 Patch1: %{name}-no_libelf.patch
38 Patch2: %{name}-ipv6.patch
39 Patch3: %{name}-nano.patch
40 Patch4: %{name}-no_avahi.patch
42 Patch101: %{name}-4.2.6p1-sleep.patch
43 Patch102: %{name}-4.2.6p1-droproot.patch
44 Patch103: %{name}-4.2.6p1-bcast.patch
45 Patch104: %{name}-4.2.6p1-cmsgalign.patch
46 Patch105: %{name}-4.2.6p1-linkfastmath.patch
47 Patch107: %{name}-4.2.6p1-retcode.patch
48 Patch108: %{name}-4.2.6p1-rtnetlink.patch
49 Patch110: %{name}-logdefault.patch
50 Patch111: %{name}-4.2.6p1-mlock.patch
51 URL: http://www.ntp.org/
52 BuildRequires: autoconf >= 2.61
53 BuildRequires: autogen-devel
54 BuildRequires: automake >= 1:1.10
55 %{?with_avahi:BuildRequires: avahi-compat-libdns_sd-devel}
56 BuildRequires: libcap-devel
57 %{?with_sntp:BuildRequires: libevent-devel >= 2.0}
58 BuildRequires: libnl-devel
59 %{?with_seccomp:BuildRequires: libseccomp-devel}
60 BuildRequires: libtool
61 BuildRequires: net-snmp-devel
62 BuildRequires: openssl-devel >= 0.9.7d
63 BuildRequires: pciutils-devel
64 BuildRequires: readline-devel >= 4.2
65 BuildRequires: rpm-perlprov >= 4.1-13
66 BuildRequires: rpmbuild(macros) >= 1.626
67 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69 %define _sysconfdir /etc/ntp
70 %define _bindir %{_sbindir}
71 %define mibdir %{_datadir}/mibs
74 The Network Time Protocol (NTP) is used to synchronize a computer's
75 time with another reference time source. The ntp package contains
76 utilities and daemons which will synchronize your computer's time to
77 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
79 %description -l pl.UTF-8
80 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
81 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
82 służące do dokładnego synchronizowania czasu komputera według czasu
83 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
85 %description -l pt_BR.UTF-8
86 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
87 utilizado para sincronizar o relógio do computador com uma outra
88 referência de horário. Este pacote contém utilitários e servidores que
89 sincronizarão o relógio do seu computador com o horário universal
90 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
92 Instale o pacote ntp se você necessitar de ferramentas para manter o
93 relógio do seu computador constantemente atualizado.
96 Summary: The NTP daemon
97 Summary(pl.UTF-8): Narzędzia do synchronizacji czasu (Network Time Protocol)
98 Summary(pt_BR.UTF-8): Network Time Protocol versão 4
100 Requires(post,preun): /sbin/chkconfig
101 Requires(postun): /usr/sbin/groupdel
102 Requires(postun): /usr/sbin/userdel
103 Requires(pre): /bin/id
104 Requires(pre): /usr/bin/getgid
105 Requires(pre): /usr/sbin/groupadd
106 Requires(pre): /usr/sbin/useradd
107 Requires(post,preun,postun): systemd-units >= 38
108 Requires: rc-scripts >= 0.4.3.0
109 Requires: systemd-units >= 38
110 Requires: autogen-libs >= 5.18.12
112 Provides: ntp = %{version}-%{release}
115 Obsoletes: ntp < 4.2.4p8-6
121 The Network Time Protocol (NTP) is used to synchronize a computer's
122 time with another reference time source. The ntp package contains
123 utilities and daemons which will synchronize your computer's time to
124 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
126 This package includes ntpd (a daemon which continuously adjusts system
129 %description -n ntpd -l pl.UTF-8
130 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
131 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
132 służące do dokładnego synchronizowania czasu komputera według czasu
133 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
135 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
138 %description -n ntpd -l pt_BR.UTF-8
139 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
140 utilizado para sincronizar o relógio do computador com uma outra
141 referência de horário. Este pacote contém utilitários e servidores que
142 sincronizarão o relógio do seu computador com o horário universal
143 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
146 Summary: Utility to set the date and time via NTP
147 Summary(pl.UTF-8): Klient do synchronizacji czasu po NTP (Network Time Protocol)
148 Group: Applications/Networking
149 Requires(post,preun): /sbin/chkconfig
150 Requires(postun): /usr/sbin/groupdel
151 Requires(postun): /usr/sbin/userdel
152 Requires(pre): /bin/id
153 Requires(pre): /usr/bin/getgid
154 Requires(pre): /usr/sbin/groupadd
155 Requires(pre): /usr/sbin/useradd
156 Requires(post,preun,postun): systemd-units >= 38
157 Requires: rc-scripts >= 0.4.3.0
158 Requires: systemd-units >= 38
161 Conflicts: ntp < 4.2.0-3
163 Provides: ntp-client = %{version}-%{release}
164 Obsoletes: ntp-client < 4.2.4p8-6
169 %description -n ntpdate
170 ntpdate is a program for retrieving the date and time from NTP
173 %description -n ntpdate -l pl.UTF-8
174 Klient do synchronizacji czasu po NTP (Network Time Protocol).
177 Summary: MIBs for NTP time entities
178 Summary(pl.UTF-8): Pliki MIB dla elementów czasu NTP
179 Group: Applications/System
181 %if "%{_rpmversion}" >= "5"
185 %description -n mibs-ntp
186 The Management Information Base for NTP time entities.
188 %description -n mibs-ntp -l pl.UTF-8
189 Pliki MIB (Management Information Base) dla elementów czasu NTP
191 %package -n net-snmp-ntpd
192 Summary: NTP SNMP subagent for Net-SNMP
193 Summary(pl.UTF-8): Podagent SNMP NTP dla usługi Net-SNMP
195 Requires(post,preun): /sbin/chkconfig
200 %description -n net-snmp-ntpd
201 NTP SNMP AgentX subagent for Net-SNMP.
203 %description -n net-snmp-ntpd -l pl.UTF-8
204 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
208 Summary(pl.UTF-8): Narzędzia NTP
209 Group: Applications/Networking
210 Obsoletes: ntp-ntptrace
213 This package contains NTP tools:
214 - ntptrace: Trace a chain of NTP servers back to the primary source
215 - ntp-wait: Wait for NTP server to synchronize
216 - calc_tickadj: Calculate optimal value for tick given ntp drift file
218 %description tools -l pl.UTF-8
219 Ten pakiet zawiera narzędzia NTP:
220 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
221 - ntp-wait: oczekiwanie na synchronizację serwera NTP
222 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
225 Summary: HTML documentation for ntp
226 Summary(pl.UTF-8): Dokumentacja HTML dla ntp
227 Summary(pt_BR.UTF-8): Documentação adicional para o pacote ntp
229 %if "%{_rpmversion}" >= "5"
233 %description doc-html
234 HTML documentation for ntp.
236 %description doc-html -l pl.UTF-8
237 Dokumentacja do ntp w HTML.
239 %description doc-html -l pt_BR.UTF-8
240 Este pacote contém documentação adicional sobre o NTP versão 4.
248 %{!?with_avahi:%patch4 -p1}
259 #%patch111 -p1 -- obsolete?
261 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
262 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
264 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
268 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
273 %{__aclocal} -I m4 -I libopts/m4 -I libevent/m4
283 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
285 --disable-silent-rules \
286 --with-binsubdir=sbin \
288 --enable-getifaddrs \
289 %{?with_seccomp:--enable-libseccomp} \
290 %{__with_without sntp} \
293 --with-lineeditlibs=readline \
294 --with-crypto=openssl \
295 --disable-local-libopts \
296 --disable-local-libevent
301 rm -rf $RPM_BUILD_ROOT
302 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
303 $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
304 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly}
307 DESTDIR=$RPM_BUILD_ROOT
309 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
310 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
311 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.leapseconds
313 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
314 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
315 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
316 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
318 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
319 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
320 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
321 echo 'ntpd.service' > \
322 $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
324 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
326 install -d $RPM_BUILD_ROOT/var/lib/ntp
327 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
329 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
331 # Source function library.
332 . /etc/rc.d/init.d/functions
334 # Source ntpdate configuration
335 . /etc/sysconfig/ntpdate
337 is_yes "$NTPDATE_CRON" || exit 0
338 exec %{_sbindir}/ntpdate-wrapper
341 install -d $RPM_BUILD_ROOT%{mibdir}
342 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
344 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp,sntp}
347 rm -rf $RPM_BUILD_ROOT
351 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
354 /sbin/chkconfig --add ntpd
355 %service ntpd restart "NTP Daemon"
356 %systemd_post ntpd.service
359 if [ "$1" = "0" ]; then
361 /sbin/chkconfig --del ntpd
362 rm -f /var/lib/ntp/drift
364 %systemd_preun ntpd.service
367 if [ "$1" = "0" ]; then
375 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
378 /sbin/chkconfig --add ntpdate
379 %service ntpdate restart "NTP Date"
380 %systemd_post ntpdate.service
383 if [ "$1" = "0" ]; then
384 %service ntpdate stop
385 /sbin/chkconfig --del ntpdate
387 %systemd_preun ntpdate.service
390 if [ "$1" = "0" ]; then
396 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
397 # Prevent preun from ntp from working
398 chmod a-x /etc/rc.d/init.d/ntpd
400 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
401 # Restore what triggerun removed
402 chmod 754 /etc/rc.d/init.d/ntpd
403 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
404 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
405 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
406 %service -q ntpd restart
407 %systemd_trigger ntpd.service
408 %systemd_post ntpdate
410 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
411 %systemd_trigger ntpd.service
413 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
414 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
415 cp -f /etc/sysconfig/ntpdate{,.rpmnew}
416 mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
418 %systemd_trigger ntpdate.service
420 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
421 %systemd_trigger ntpdate.service
424 %defattr(644,root,root,755)
425 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
426 %attr(750,root,root) %dir %{_sysconfdir}
427 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/keys
428 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.conf
429 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.leapseconds
430 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
431 %attr(754,root,root) /etc/rc.d/init.d/ntpd
432 %{systemdunitdir}/ntpd.service
433 # dir not handled by systemd in pld
434 #%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
435 %attr(755,root,root) %{_sbindir}/ntpd
436 %attr(755,root,root) %{_sbindir}/ntpdc
437 %attr(755,root,root) %{_sbindir}/ntp-keygen
438 %attr(755,root,root) %{_sbindir}/ntpq
439 %attr(755,root,root) %{_sbindir}/ntptime
440 %attr(755,root,root) %{_sbindir}/sntp
441 %attr(755,root,root) %{_sbindir}/tickadj
442 %attr(755,root,root) %{_sbindir}/update-leap
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}/man1/update-leap.1*
450 %{_mandir}/man5/ntp.conf.5*
451 %{_mandir}/man5/ntp.keys.5*
453 %dir %attr(770,root,ntp) /var/lib/ntp
454 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
457 %defattr(644,root,root,755)
459 %attr(755,root,root) %{_sbindir}/ntpdate
460 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
461 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
462 %attr(754,root,root) /etc/cron.hourly/ntpdate
463 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
464 %{systemdunitdir}/ntpdate.service
465 %{_mandir}/man1/ntpdate.1*
468 %defattr(644,root,root,755)
469 %{mibdir}/ntpv4-mib.mib
471 %files -n net-snmp-ntpd
472 %defattr(644,root,root,755)
474 %attr(755,root,root) %{_sbindir}/ntpsnmpd
475 %{_mandir}/man1/ntpsnmpd.1*
478 %defattr(644,root,root,755)
479 %attr(755,root,root) %{_sbindir}/calc_tickadj
480 %attr(755,root,root) %{_sbindir}/ntp-wait
481 %attr(755,root,root) %{_sbindir}/ntptrace
484 %{_mandir}/man1/calc_tickadj.1*
485 %{_mandir}/man1/ntp-wait.1*
486 %{_mandir}/man1/ntptrace.1*
489 %defattr(644,root,root,755)