]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
- release 4 (by relup.sh)
[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 %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
16 Name:           ntp
17 Version:        4.2.8p12
18 Release:        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
23 Source1:        %{name}.conf
24 Source2:        %{name}.keys
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
40 # FC patches + 100
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)
69
70 %define         _sysconfdir     /etc/ntp
71 %define         _bindir         %{_sbindir}
72 %define         mibdir          %{_datadir}/mibs
73
74 %description
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.
79
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.
85
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.
92
93 Instale o pacote ntp se você necessitar de ferramentas para manter o
94 relógio do seu computador constantemente atualizado.
95
96 %package -n ntpd
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
100 Group:          Daemons
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
110 Requires:       libgcc
111 Requires:       rc-scripts >= 0.4.3.0
112 Requires:       systemd-units >= 38
113 Provides:       group(ntp)
114 Provides:       ntp = %{version}-%{release}
115 Provides:       ntpdaemon
116 Provides:       user(ntp)
117 Obsoletes:      ntp < 4.2.4p8-6
118 Obsoletes:      ntpdaemon
119 Obsoletes:      openntpd
120 Obsoletes:      xntp3
121
122 %description -n ntpd
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.
127
128 This package includes ntpd (a daemon which continuously adjusts system
129 time)
130
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.
136
137 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
138 czas systemowy)
139
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.
146
147 %package -n ntpdate
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
161 Provides:       group(ntp)
162 Provides:       user(ntp)
163 Conflicts:      ntp < 4.2.0-3
164 # for upgrades
165 Provides:       ntp-client = %{version}-%{release}
166 Obsoletes:      ntp-client < 4.2.4p8-6
167 # virtual
168 Provides:       ntpclient
169 Obsoletes:      ntpclient
170
171 %description -n ntpdate
172 ntpdate is a program for retrieving the date and time from NTP
173 servers.
174
175 %description -n ntpdate -l pl.UTF-8
176 Klient do synchronizacji czasu po NTP (Network Time Protocol).
177
178 %package -n mibs-ntp
179 Summary:        MIBs for NTP time entities
180 Summary(pl.UTF-8):      Pliki MIB dla elementów czasu NTP
181 Group:          Applications/System
182 Requires:       mibs-dirs
183 %if "%{_rpmversion}" >= "5"
184 BuildArch:      noarch
185 %endif
186
187 %description -n mibs-ntp
188 The Management Information Base for NTP time entities.
189
190 %description -n mibs-ntp -l pl.UTF-8
191 Pliki MIB (Management Information Base) dla elementów czasu NTP
192
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
196 Group:          Daemons
197 Requires(post,preun):   /sbin/chkconfig
198 Requires:       net-snmp
199 Requires:       rc-scripts
200 Suggests:       mibs-ntp
201
202 %description -n net-snmp-ntpd
203 NTP SNMP AgentX subagent for Net-SNMP.
204
205 %description -n net-snmp-ntpd -l pl.UTF-8
206 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
207
208 %package tools
209 Summary:        NTP tools
210 Summary(pl.UTF-8):      Narzędzia NTP
211 Group:          Applications/Networking
212 Obsoletes:      ntp-ntptrace
213
214 %description tools
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
219
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
225
226 %package doc-html
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
230 Group:          Documentation
231 %if "%{_rpmversion}" >= "5"
232 BuildArch:      noarch
233 %endif
234
235 %description doc-html
236 HTML documentation for ntp.
237
238 %description doc-html -l pl.UTF-8
239 Dokumentacja do ntp w HTML.
240
241 %description doc-html -l pt_BR.UTF-8
242 Este pacote contém documentação adicional sobre o NTP versão 4.
243
244 %prep
245 %setup -q -a7
246 %patch0 -p1
247 %patch1 -p1
248 %patch2 -p1
249 %patch3 -p1
250
251 ## FC patches
252 #%patch101 -p1
253 %patch102 -p1
254 #%patch103 -p1
255 %patch104 -p1
256 %patch105 -p1
257 %patch107 -p1
258 %patch108 -p1
259 %patch110 -p1
260 #%patch111 -p1  -- obsolete?
261
262 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
263 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
264
265 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
266
267 %build
268 %{__libtoolize}
269 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
270 %{__autoconf}
271 %{__automake}
272 cd sntp
273 %{__libtoolize}
274 %{__aclocal} -I m4 -I libopts/m4 -I libevent/m4
275 %{__autoconf}
276 %{__automake}
277 cd libevent
278 %{__libtoolize}
279 %{__aclocal} -I m4
280 %{__autoconf}
281 %{__automake}
282 cd ../..
283
284 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
285 %configure \
286         --disable-silent-rules \
287         --with-binsubdir=sbin \
288         --enable-linuxcaps \
289         --enable-getifaddrs \
290         %{?with_seccomp:--enable-libseccomp} \
291         %{__with_without sntp} \
292         --enable-ipv6 \
293         --enable-ntp-signd \
294         --with-lineeditlibs=readline \
295         --with-crypto=openssl \
296         --disable-local-libopts \
297         --disable-local-libevent
298
299 %{__make} -j1
300
301 %install
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}
306
307 %{__make} install \
308         DESTDIR=$RPM_BUILD_ROOT
309
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
313
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
318
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
324
325 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
326
327 install -d $RPM_BUILD_ROOT/var/lib/ntp
328 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
329
330 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
331 #!/bin/sh
332 # Source function library.
333 . /etc/rc.d/init.d/functions
334
335 # Source ntpdate configuration
336 . /etc/sysconfig/ntpdate
337
338 is_yes "$NTPDATE_CRON" || exit 0
339 exec %{_sbindir}/ntpdate-wrapper
340 EOF
341
342 install -d $RPM_BUILD_ROOT%{mibdir}
343 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
344
345 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp,sntp}
346
347 %clean
348 rm -rf $RPM_BUILD_ROOT
349
350 %pre -n ntpd
351 %groupadd -g 246 ntp
352 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
353
354 %post -n ntpd
355 /sbin/chkconfig --add ntpd
356 %service ntpd restart "NTP Daemon"
357 %systemd_post ntpd.service
358
359 %preun -n ntpd
360 if [ "$1" = "0" ]; then
361         %service ntpd stop
362         /sbin/chkconfig --del ntpd
363         rm -f /var/lib/ntp/drift
364 fi
365 %systemd_preun ntpd.service
366
367 %postun -n ntp
368 if [ "$1" = "0" ]; then
369         %userremove ntp
370         %groupremove ntp
371 fi
372 %systemd_reload
373
374 %pre -n ntpdate
375 %groupadd -g 246 ntp
376 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
377
378 %post -n ntpdate
379 /sbin/chkconfig --add ntpdate
380 %service ntpdate restart "NTP Date"
381 %systemd_post ntpdate.service
382
383 %preun -n ntpdate
384 if [ "$1" = "0" ]; then
385         %service ntpdate stop
386         /sbin/chkconfig --del ntpdate
387 fi
388 %systemd_preun ntpdate.service
389
390 %postun -n ntpdate
391 if [ "$1" = "0" ]; then
392         %userremove ntp
393         %groupremove ntp
394 fi
395 %systemd_reload
396
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
400
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
410
411 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
412 %systemd_trigger ntpd.service
413
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
418 fi
419 %systemd_trigger ntpdate.service
420
421 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
422 %systemd_trigger ntpdate.service
423
424 %files -n ntpd
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*
451
452 %dir %attr(770,root,ntp) /var/lib/ntp
453 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
454
455 %files -n ntpdate
456 %defattr(644,root,root,755)
457 %doc COPYRIGHT
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*
465
466 %files -n mibs-ntp
467 %defattr(644,root,root,755)
468 %{mibdir}/ntpv4-mib.mib
469
470 %files -n net-snmp-ntpd
471 %defattr(644,root,root,755)
472 %doc ntpsnmpd/README
473 %attr(755,root,root) %{_sbindir}/ntpsnmpd
474 %{_mandir}/man1/ntpsnmpd.1*
475
476 %files tools
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
482 %dir %{_datadir}/ntp
483 %{_datadir}/ntp/lib
484 %{_mandir}/man1/calc_tickadj.1*
485 %{_mandir}/man1/ntp-wait.1*
486 %{_mandir}/man1/ntptrace.1*
487 %{_mandir}/man1/update-leap.1*
488
489 %files doc-html
490 %defattr(644,root,root,755)
491 %doc html/*
This page took 0.086905 seconds and 4 git commands to generate.