]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
db728da017bafdd6b118563e696e849ff9817a92
[packages/ntp.git] / ntp.spec
1 # TODO:
2 # - enable and package ntpdsim?
3 # - net-snmp-ntpd needs initscript
4 # - update FC patches
5 # - update man pages (from Debian?)
6 #
7 # Conditional build:
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
11
12 Summary:        Network Time Protocol utilities
13 Summary(pl.UTF-8):      Narzędzia do synchronizacji czasu (Network Time Protocol)
14 Summary(pt_BR.UTF-8):   Network Time Protocol versão 4
15 Name:           ntp
16 Version:        4.2.8p12
17 Release:        6
18 License:        distributable
19 Group:          Networking/Daemons
20 Source0:        https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
21 # Source0-md5:  1522d66574bae14abb2622746dad2bdc
22 Source1:        %{name}.conf
23 Source2:        %{name}.keys
24 Source3:        %{name}d.init
25 Source4:        %{name}d.sysconfig
26 Source5:        %{name}date.init
27 Source6:        %{name}date.sysconfig
28 Source7:        %{name}-manpages.tar.gz
29 # Source7-md5:  208fcc9019e19ab26d28e4597290bffb
30 Source10:       %{name}date-wrapper
31 Source11:       %{name}d.service
32 Source12:       %{name}date.service
33 Source13:       https://www.ietf.org/timezones/data/leap-seconds.list
34 # Source13-md5: 961f9b603309f2d12dcb420c054eff5f
35 Patch0:         %{name}-build.patch
36 Patch1:         %{name}-no_libelf.patch
37 Patch2:         %{name}-ipv6.patch
38 Patch3:         %{name}-nano.patch
39 # FC patches + 100
40 Patch101:       %{name}-4.2.6p1-sleep.patch
41 Patch102:       %{name}-4.2.6p1-droproot.patch
42 Patch103:       %{name}-4.2.6p1-bcast.patch
43 Patch104:       %{name}-4.2.6p1-cmsgalign.patch
44 Patch105:       %{name}-4.2.6p1-linkfastmath.patch
45 Patch107:       %{name}-4.2.6p1-retcode.patch
46 Patch108:       %{name}-4.2.6p1-rtnetlink.patch
47 Patch110:       %{name}-logdefault.patch
48 Patch111:       %{name}-4.2.6p1-mlock.patch
49 URL:            http://www.ntp.org/
50 BuildRequires:  autoconf >= 2.61
51 BuildRequires:  autogen-devel >= 5.18.12
52 BuildRequires:  automake >= 1:1.10
53 %{?with_avahi:BuildRequires:    avahi-compat-libdns_sd-devel}
54 BuildRequires:  libcap-devel
55 %{?with_sntp:BuildRequires:     libevent-devel >= 2.0}
56 BuildRequires:  libnl-devel
57 %{?with_seccomp:BuildRequires:  libseccomp-devel}
58 BuildRequires:  libtool
59 BuildRequires:  net-snmp-devel
60 BuildRequires:  openssl-devel >= 0.9.7d
61 BuildRequires:  pciutils-devel
62 # AUTO: -- checking for pkg-config... no
63 BuildRequires:  pkgconfig
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)
68
69 %define         _sysconfdir     /etc/ntp
70 %define         _bindir         %{_sbindir}
71 %define         mibdir          %{_datadir}/mibs
72
73 %description
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.
78
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.
84
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.
91
92 Instale o pacote ntp se você necessitar de ferramentas para manter o
93 relógio do seu computador constantemente atualizado.
94
95 %package -n ntpd
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
99 Group:          Daemons
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_ge autogen-libs
109 Requires:       libgcc
110 Requires:       rc-scripts >= 0.4.3.0
111 Requires:       systemd-units >= 38
112 Provides:       group(ntp)
113 Provides:       ntp = %{version}-%{release}
114 Provides:       ntpdaemon
115 Provides:       user(ntp)
116 Obsoletes:      ntp < 4.2.4p8-6
117 Obsoletes:      ntpdaemon
118 Obsoletes:      openntpd
119 Obsoletes:      xntp3
120
121 %description -n ntpd
122 The Network Time Protocol (NTP) is used to synchronize a computer's
123 time with another reference time source. The ntp package contains
124 utilities and daemons which will synchronize your computer's time to
125 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
126
127 This package includes ntpd (a daemon which continuously adjusts system
128 time)
129
130 %description -n ntpd -l pl.UTF-8
131 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
132 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
133 służące do dokładnego synchronizowania czasu komputera według czasu
134 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
135
136 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
137 czas systemowy)
138
139 %description -n ntpd -l pt_BR.UTF-8
140 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
141 utilizado para sincronizar o relógio do computador com uma outra
142 referência de horário. Este pacote contém utilitários e servidores que
143 sincronizarão o relógio do seu computador com o horário universal
144 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
145
146 %package -n ntpdate
147 Summary:        Utility to set the date and time via NTP
148 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
149 Group:          Applications/Networking
150 Requires(post,preun):   /sbin/chkconfig
151 Requires(postun):       /usr/sbin/groupdel
152 Requires(postun):       /usr/sbin/userdel
153 Requires(pre):  /bin/id
154 Requires(pre):  /usr/bin/getgid
155 Requires(pre):  /usr/sbin/groupadd
156 Requires(pre):  /usr/sbin/useradd
157 Requires(post,preun,postun):    systemd-units >= 38
158 Requires:       rc-scripts >= 0.4.3.0
159 Requires:       systemd-units >= 38
160 Provides:       group(ntp)
161 Provides:       user(ntp)
162 Conflicts:      ntp < 4.2.0-3
163 # for upgrades
164 Provides:       ntp-client = %{version}-%{release}
165 Obsoletes:      ntp-client < 4.2.4p8-6
166 # virtual
167 Provides:       ntpclient
168 Obsoletes:      ntpclient
169
170 %description -n ntpdate
171 ntpdate is a program for retrieving the date and time from NTP
172 servers.
173
174 %description -n ntpdate -l pl.UTF-8
175 Klient do synchronizacji czasu po NTP (Network Time Protocol).
176
177 %package -n mibs-ntp
178 Summary:        MIBs for NTP time entities
179 Summary(pl.UTF-8):      Pliki MIB dla elementów czasu NTP
180 Group:          Applications/System
181 Requires:       mibs-dirs
182 %if "%{_rpmversion}" >= "5"
183 BuildArch:      noarch
184 %endif
185
186 %description -n mibs-ntp
187 The Management Information Base for NTP time entities.
188
189 %description -n mibs-ntp -l pl.UTF-8
190 Pliki MIB (Management Information Base) dla elementów czasu NTP
191
192 %package -n net-snmp-ntpd
193 Summary:        NTP SNMP subagent for Net-SNMP
194 Summary(pl.UTF-8):      Podagent SNMP NTP dla usługi Net-SNMP
195 Group:          Daemons
196 Requires(post,preun):   /sbin/chkconfig
197 Requires:       net-snmp
198 Requires:       rc-scripts
199 Suggests:       mibs-ntp
200
201 %description -n net-snmp-ntpd
202 NTP SNMP AgentX subagent for Net-SNMP.
203
204 %description -n net-snmp-ntpd -l pl.UTF-8
205 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
206
207 %package tools
208 Summary:        NTP tools
209 Summary(pl.UTF-8):      Narzędzia NTP
210 Group:          Applications/Networking
211 Obsoletes:      ntp-ntptrace
212
213 %description tools
214 This package contains NTP tools:
215 - ntptrace: Trace a chain of NTP servers back to the primary source
216 - ntp-wait: Wait for NTP server to synchronize
217 - calc_tickadj: Calculate optimal value for tick given ntp drift file
218
219 %description tools -l pl.UTF-8
220 Ten pakiet zawiera narzędzia NTP:
221 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
222 - ntp-wait: oczekiwanie na synchronizację serwera NTP
223 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
224
225 %package doc-html
226 Summary:        HTML documentation for ntp
227 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
228 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
229 Group:          Documentation
230 %if "%{_rpmversion}" >= "5"
231 BuildArch:      noarch
232 %endif
233
234 %description doc-html
235 HTML documentation for ntp.
236
237 %description doc-html -l pl.UTF-8
238 Dokumentacja do ntp w HTML.
239
240 %description doc-html -l pt_BR.UTF-8
241 Este pacote contém documentação adicional sobre o NTP versão 4.
242
243 %prep
244 %setup -q -a7
245 %patch0 -p1
246 %patch1 -p1
247 %patch2 -p1
248 %patch3 -p1
249
250 ## FC patches
251 #%patch101 -p1
252 %patch102 -p1
253 #%patch103 -p1
254 %patch104 -p1
255 %patch105 -p1
256 %patch107 -p1
257 %patch108 -p1
258 %patch110 -p1
259 #%patch111 -p1  -- obsolete?
260
261 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
262 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
263
264 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
265
266 %build
267 %{__libtoolize}
268 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
269 %{__autoconf}
270 %{__automake}
271 cd sntp
272 %{__libtoolize}
273 %{__aclocal} -I m4 -I libopts/m4 -I libevent/m4
274 %{__autoconf}
275 %{__automake}
276 cd libevent
277 %{__libtoolize}
278 %{__aclocal} -I m4
279 %{__autoconf}
280 %{__automake}
281 cd ../..
282
283 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
284 %configure \
285         --disable-silent-rules \
286         --with-binsubdir=sbin \
287         --enable-linuxcaps \
288         --enable-getifaddrs \
289         %{?with_seccomp:--enable-libseccomp} \
290         %{__with_without sntp} \
291         --enable-ipv6 \
292         --enable-ntp-signd \
293         --with-lineeditlibs=readline \
294         --with-crypto=openssl \
295         --disable-local-libopts \
296         --disable-local-libevent
297
298 %{__make} -j1
299
300 %install
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}
305
306 %{__make} install \
307         DESTDIR=$RPM_BUILD_ROOT
308
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
312
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
317
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
323
324 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
325
326 install -d $RPM_BUILD_ROOT/var/lib/ntp
327 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
328
329 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
330 #!/bin/sh
331 # Source function library.
332 . /etc/rc.d/init.d/functions
333
334 # Source ntpdate configuration
335 . /etc/sysconfig/ntpdate
336
337 is_yes "$NTPDATE_CRON" || exit 0
338 exec %{_sbindir}/ntpdate-wrapper
339 EOF
340
341 install -d $RPM_BUILD_ROOT%{mibdir}
342 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
343
344 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp,sntp}
345
346 %clean
347 rm -rf $RPM_BUILD_ROOT
348
349 %pre -n ntpd
350 %groupadd -g 246 ntp
351 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
352
353 %post -n ntpd
354 /sbin/chkconfig --add ntpd
355 %service ntpd restart "NTP Daemon"
356 %systemd_post ntpd.service
357
358 %preun -n ntpd
359 if [ "$1" = "0" ]; then
360         %service ntpd stop
361         /sbin/chkconfig --del ntpd
362         rm -f /var/lib/ntp/drift
363 fi
364 %systemd_preun ntpd.service
365
366 %postun -n ntp
367 if [ "$1" = "0" ]; then
368         %userremove ntp
369         %groupremove ntp
370 fi
371 %systemd_reload
372
373 %pre -n ntpdate
374 %groupadd -g 246 ntp
375 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
376
377 %post -n ntpdate
378 /sbin/chkconfig --add ntpdate
379 %service ntpdate restart "NTP Date"
380 %systemd_post ntpdate.service
381
382 %preun -n ntpdate
383 if [ "$1" = "0" ]; then
384         %service ntpdate stop
385         /sbin/chkconfig --del ntpdate
386 fi
387 %systemd_preun ntpdate.service
388
389 %postun -n ntpdate
390 if [ "$1" = "0" ]; then
391         %userremove ntp
392         %groupremove ntp
393 fi
394 %systemd_reload
395
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
399
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
409
410 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
411 %systemd_trigger ntpd.service
412
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
417 fi
418 %systemd_trigger ntpdate.service
419
420 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
421 %systemd_trigger ntpdate.service
422
423 %files -n ntpd
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 %{_mandir}/man1/ntpd.1*
443 %{_mandir}/man1/ntpdc.1*
444 %{_mandir}/man1/ntp-keygen.1*
445 %{_mandir}/man1/ntpq.1*
446 %{_mandir}/man1/ntptime.1*
447 %{_mandir}/man1/sntp.1*
448 %{_mandir}/man5/ntp.conf.5*
449 %{_mandir}/man5/ntp.keys.5*
450
451 %dir %attr(770,root,ntp) /var/lib/ntp
452 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
453
454 %files -n ntpdate
455 %defattr(644,root,root,755)
456 %doc COPYRIGHT
457 %attr(755,root,root) %{_sbindir}/ntpdate
458 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
459 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
460 %attr(754,root,root) /etc/cron.hourly/ntpdate
461 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
462 %{systemdunitdir}/ntpdate.service
463 %{_mandir}/man1/ntpdate.1*
464
465 %files -n mibs-ntp
466 %defattr(644,root,root,755)
467 %{mibdir}/ntpv4-mib.mib
468
469 %files -n net-snmp-ntpd
470 %defattr(644,root,root,755)
471 %doc ntpsnmpd/README
472 %attr(755,root,root) %{_sbindir}/ntpsnmpd
473 %{_mandir}/man1/ntpsnmpd.1*
474
475 %files tools
476 %defattr(644,root,root,755)
477 %attr(755,root,root) %{_sbindir}/calc_tickadj
478 %attr(755,root,root) %{_sbindir}/ntp-wait
479 %attr(755,root,root) %{_sbindir}/ntptrace
480 %attr(755,root,root) %{_sbindir}/update-leap
481 %dir %{_datadir}/ntp
482 %{_datadir}/ntp/lib
483 %{_mandir}/man1/calc_tickadj.1*
484 %{_mandir}/man1/ntp-wait.1*
485 %{_mandir}/man1/ntptrace.1*
486 %{_mandir}/man1/update-leap.1*
487
488 %files doc-html
489 %defattr(644,root,root,755)
490 %doc html/*
This page took 0.674823 seconds and 2 git commands to generate.