]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
- addes seccomp bcond, disabled by default due to ntpd crashes
[packages/ntp.git] / ntp.spec
1 # TODO:
2 # - enable and package ntpdsim?
3 # - net-snmp-ntpd needs initscript
4 # - update FC patches
5 #
6 # Conditional build:
7 %bcond_without  avahi  # disable DNS-SD support via Avahi
8 %bcond_with     seccomp         # enable experimental support for libseccomp sandboxing
9
10 %include        /usr/lib/rpm/macros.perl
11 Summary:        Network Time Protocol utilities
12 Summary(pl.UTF-8):      Narzędzia do synchronizacji czasu (Network Time Protocol)
13 Summary(pt_BR.UTF-8):   Network Time Protocol versão 4
14 Name:           ntp
15 Version:        4.2.8p3
16 Release:        2
17 License:        distributable
18 Group:          Networking/Daemons
19 Source0:        http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
20 # Source0-md5:  b98b0cbb72f6df04608e1dd5f313808b
21 Source1:        %{name}.conf
22 Source2:        %{name}.keys
23 Source3:        %{name}d.init
24 Source4:        %{name}d.sysconfig
25 Source5:        %{name}date.init
26 Source6:        %{name}date.sysconfig
27 Source7:        %{name}-manpages.tar.gz
28 # Source7-md5:  208fcc9019e19ab26d28e4597290bffb
29 Source10:       %{name}date-wrapper
30 Source11:       %{name}d.service
31 Source12:       %{name}date.service
32 Source13:       http://www.ietf.org/timezones/data/leap-seconds.list
33 # Source13-md5: e99a84cf28b14c77fba76c05565604ac
34 Patch0:         %{name}-build.patch
35 Patch1:         %{name}-no_libelf.patch
36 Patch2:         %{name}-ipv6.patch
37 Patch3:         %{name}-nano.patch
38 Patch4:         %{name}-no_avahi.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
51 BuildRequires:  autogen-devel
52 BuildRequires:  automake
53 %{?with_avahi:BuildRequires:    avahi-compat-libdns_sd-devel}
54 BuildRequires:  libcap-devel
55 BuildRequires:  libevent-devel
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 BuildRequires:  readline-devel >= 4.2
63 BuildRequires:  rpm-perlprov >= 4.1-13
64 BuildRequires:  rpmbuild(macros) >= 1.626
65 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
66
67 %define         _sysconfdir     /etc/ntp
68 %define         _bindir         %{_sbindir}
69 %define         mibdir          %{_datadir}/mibs
70
71 %description
72 The Network Time Protocol (NTP) is used to synchronize a computer's
73 time with another reference time source. The ntp package contains
74 utilities and daemons which will synchronize your computer's time to
75 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
76
77 %description -l pl.UTF-8
78 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
79 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
80 służące do dokładnego synchronizowania czasu komputera według czasu
81 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
82
83 %description -l pt_BR.UTF-8
84 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
85 utilizado para sincronizar o relógio do computador com uma outra
86 referência de horário. Este pacote contém utilitários e servidores que
87 sincronizarão o relógio do seu computador com o horário universal
88 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
89
90 Instale o pacote ntp se você necessitar de ferramentas para manter o
91 relógio do seu computador constantemente atualizado.
92
93 %package -n ntpd
94 Summary:        The NTP daemon
95 Summary(pl.UTF-8):      Narzędzia do synchronizacji czasu (Network Time Protocol)
96 Summary(pt_BR.UTF-8):   Network Time Protocol versão 4
97 Group:          Daemons
98 Requires(post,preun):   /sbin/chkconfig
99 Requires(postun):       /usr/sbin/groupdel
100 Requires(postun):       /usr/sbin/userdel
101 Requires(pre):  /bin/id
102 Requires(pre):  /usr/bin/getgid
103 Requires(pre):  /usr/sbin/groupadd
104 Requires(pre):  /usr/sbin/useradd
105 Requires(post,preun,postun):    systemd-units >= 38
106 Requires:       rc-scripts >= 0.4.3.0
107 Requires:       systemd-units >= 38
108 Provides:       group(ntp)
109 Provides:       ntp = %{version}-%{release}
110 Provides:       ntpdaemon
111 Provides:       user(ntp)
112 Obsoletes:      ntp < 4.2.4p8-6
113 Obsoletes:      ntpdaemon
114 Obsoletes:      openntpd
115 Obsoletes:      xntp3
116
117 %description -n ntpd
118 The Network Time Protocol (NTP) is used to synchronize a computer's
119 time with another reference time source. The ntp package contains
120 utilities and daemons which will synchronize your computer's time to
121 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
122
123 This package includes ntpd (a daemon which continuously adjusts system
124 time)
125
126 %description -n ntpd -l pl.UTF-8
127 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
128 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
129 służące do dokładnego synchronizowania czasu komputera według czasu
130 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
131
132 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
133 czas systemowy)
134
135 %description -n ntpd -l pt_BR.UTF-8
136 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
137 utilizado para sincronizar o relógio do computador com uma outra
138 referência de horário. Este pacote contém utilitários e servidores que
139 sincronizarão o relógio do seu computador com o horário universal
140 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
141
142 %package -n ntpdate
143 Summary:        Utility to set the date and time via NTP
144 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
145 Group:          Applications/Networking
146 Requires(post,preun):   /sbin/chkconfig
147 Requires(postun):       /usr/sbin/groupdel
148 Requires(postun):       /usr/sbin/userdel
149 Requires(pre):  /bin/id
150 Requires(pre):  /usr/bin/getgid
151 Requires(pre):  /usr/sbin/groupadd
152 Requires(pre):  /usr/sbin/useradd
153 Requires(post,preun,postun):    systemd-units >= 38
154 Requires:       rc-scripts >= 0.4.3.0
155 Requires:       systemd-units >= 38
156 Provides:       group(ntp)
157 Provides:       user(ntp)
158 Conflicts:      ntp < 4.2.0-3
159 # for upgrades
160 Provides:       ntp-client = %{version}-%{release}
161 Obsoletes:      ntp-client < 4.2.4p8-6
162 # virtual
163 Provides:       ntpclient
164 Obsoletes:      ntpclient
165
166 %description -n ntpdate
167 ntpdate is a program for retrieving the date and time from NTP
168 servers.
169
170 %description -n ntpdate -l pl.UTF-8
171 Klient do synchronizacji czasu po NTP (Network Time Protocol).
172
173 %package -n mibs-ntp
174 Summary:        MIBs for NTP time entities
175 Summary(pl.UTF-8):      Pliki MIB dla elementów czasu NTP
176 Group:          Applications/System
177 Requires:       mibs-dirs
178
179 %description -n mibs-ntp
180 The Management Information Base for NTP time entities.
181
182 %description -n mibs-ntp -l pl.UTF-8
183 Pliki MIB (Management Information Base) dla elementów czasu NTP
184
185 %package -n net-snmp-ntpd
186 Summary:        NTP SNMP subagent for Net-SNMP
187 Summary(pl.UTF-8):      Podagent SNMP NTP dla usługi Net-SNMP
188 Group:          Daemons
189 Requires(post,preun):   /sbin/chkconfig
190 Requires:       net-snmp
191 Requires:       rc-scripts
192 Suggests:       mibs-ntp
193
194 %description -n net-snmp-ntpd
195 NTP SNMP AgentX subagent for Net-SNMP.
196
197 %description -n net-snmp-ntpd -l pl.UTF-8
198 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
199
200 %package tools
201 Summary:        NTP tools
202 Summary(pl.UTF-8):      Narzędzia NTP
203 Group:          Applications/Networking
204 Obsoletes:      ntp-ntptrace
205
206 %description tools
207 This package contains NTP tools:
208 - ntptrace: Trace a chain of NTP servers back to the primary source
209 - ntp-wait: Wait for NTP server to synchronize
210 - calc_tickadj: Calculate optimal value for tick given ntp drift file
211
212 %description tools -l pl.UTF-8
213 Ten pakiet zawiera narzędzia NTP:
214 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
215 - ntp-wait: oczekiwanie na synchronizację serwera NTP
216 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
217
218 %package doc-html
219 Summary:        HTML documentation for ntp
220 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
221 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
222 Group:          Documentation
223
224 %description doc-html
225 HTML documentation for ntp.
226
227 %description doc-html -l pl.UTF-8
228 Dokumentacja do ntp w HTML.
229
230 %description doc-html -l pt_BR.UTF-8
231 Este pacote contém documentação adicional sobre o NTP versão 4.
232
233 %prep
234 %setup -q -a7
235 %patch0 -p1
236 %patch1 -p1
237 %patch2 -p1
238 %patch3 -p1
239 %{!?with_avahi:%patch4 -p1}
240
241 ## FC patches
242 #%patch101 -p1
243 %patch102 -p1
244 #%patch103 -p1
245 %patch104 -p1
246 %patch105 -p1
247 %patch107 -p1
248 %patch108 -p1
249 %patch110 -p1
250 #%patch111 -p1  -- obsolete?
251
252 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
253 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
254
255 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
256
257 %build
258 %{__libtoolize}
259 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
260 %{__autoconf}
261 %{__automake}
262 cd sntp
263 %{__libtoolize}
264 %{__aclocal} -I libopts/m4 -I libevent/m4
265 %{__autoconf}
266 %{__automake}
267 cd ..
268
269 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
270 %configure \
271         --with-binsubdir=sbin \
272         --enable-linuxcaps \
273         --enable-getifaddrs \
274         %{?with_seccomp:--enable-libseccomp} \
275         --enable-ipv6 \
276         --enable-ntp-signd \
277         --with-lineeditlibs=readline \
278         --with-crypto=openssl \
279         --disable-local-libopts \
280         --disable-local-libevent
281
282 %{__make} -j1
283
284 %install
285 rm -rf $RPM_BUILD_ROOT
286 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
287         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
288         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly}
289
290 %{__make} install \
291         DESTDIR=$RPM_BUILD_ROOT
292
293 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
294 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
295 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.leapseconds
296
297 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
298 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
299 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
300 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
301
302 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
303 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
304 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
305 echo 'ntpd.service' > \
306         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
307
308 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
309
310 install -d $RPM_BUILD_ROOT/var/lib/ntp
311 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
312
313 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
314 #!/bin/sh
315 # Source function library.
316 . /etc/rc.d/init.d/functions
317
318 # Source ntpdate configuration
319 . /etc/sysconfig/ntpdate
320
321 is_yes "$NTPDATE_CRON" || exit 0
322 exec %{_sbindir}/ntpdate-wrapper
323 EOF
324
325 install -d $RPM_BUILD_ROOT%{mibdir}
326 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
327
328 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp,sntp}
329
330 %clean
331 rm -rf $RPM_BUILD_ROOT
332
333 %pre -n ntpd
334 %groupadd -g 246 ntp
335 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
336
337 %post -n ntpd
338 /sbin/chkconfig --add ntpd
339 %service ntpd restart "NTP Daemon"
340 %systemd_post ntpd.service
341
342 %preun -n ntpd
343 if [ "$1" = "0" ]; then
344         %service ntpd stop
345         /sbin/chkconfig --del ntpd
346         rm -f /var/lib/ntp/drift
347 fi
348 %systemd_preun ntpd.service
349
350 %postun -n ntp
351 if [ "$1" = "0" ]; then
352         %userremove ntp
353         %groupremove ntp
354 fi
355 %systemd_reload
356
357 %pre -n ntpdate
358 %groupadd -g 246 ntp
359 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
360
361 %post -n ntpdate
362 /sbin/chkconfig --add ntpdate
363 %service ntpdate restart "NTP Date"
364 %systemd_post ntpdate.service
365
366 %preun -n ntpdate
367 if [ "$1" = "0" ]; then
368         %service ntpdate stop
369         /sbin/chkconfig --del ntpdate
370 fi
371 %systemd_preun ntpdate.service
372
373 %postun -n ntpdate
374 if [ "$1" = "0" ]; then
375         %userremove ntp
376         %groupremove ntp
377 fi
378 %systemd_reload
379
380 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
381 # Prevent preun from ntp from working
382 chmod a-x /etc/rc.d/init.d/ntpd
383
384 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
385 # Restore what triggerun removed
386 chmod 754 /etc/rc.d/init.d/ntpd
387 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
388 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
389 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
390 %service -q ntpd restart
391 %systemd_trigger ntpd.service
392 %systemd_post ntpdate
393
394 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
395 %systemd_trigger ntpd.service
396
397 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
398 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
399         cp -f /etc/sysconfig/ntpdate{,.rpmnew}
400         mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
401 fi
402 %systemd_trigger ntpdate.service
403
404 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
405 %systemd_trigger ntpdate.service
406
407 %files -n ntpd
408 %defattr(644,root,root,755)
409 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
410 %attr(750,root,root) %dir %{_sysconfdir}
411 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/keys
412 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.conf
413 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.leapseconds
414 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
415 %attr(754,root,root) /etc/rc.d/init.d/ntpd
416 %{systemdunitdir}/ntpd.service
417 # dir not handled by systemd in pld
418 #%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
419 %attr(755,root,root) %{_sbindir}/ntpd
420 %attr(755,root,root) %{_sbindir}/ntpdc
421 %attr(755,root,root) %{_sbindir}/ntp-keygen
422 %attr(755,root,root) %{_sbindir}/ntpq
423 %attr(755,root,root) %{_sbindir}/ntptime
424 %attr(755,root,root) %{_sbindir}/sntp
425 %attr(755,root,root) %{_sbindir}/tickadj
426 %attr(755,root,root) %{_sbindir}/update-leap
427 %{_mandir}/man1/ntpd.1*
428 %{_mandir}/man1/ntpdc.1*
429 %{_mandir}/man1/ntp-keygen.1*
430 %{_mandir}/man1/ntpq.1*
431 %{_mandir}/man1/ntptime.1*
432 %{_mandir}/man1/sntp.1*
433 %{_mandir}/man1/update-leap.1*
434 %{_mandir}/man5/ntp.conf.5*
435 %{_mandir}/man5/ntp.keys.5*
436
437 %dir %attr(770,root,ntp) /var/lib/ntp
438 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
439
440 %files -n ntpdate
441 %defattr(644,root,root,755)
442 %doc COPYRIGHT
443 %attr(755,root,root) %{_sbindir}/ntpdate
444 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
445 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
446 %attr(754,root,root) /etc/cron.hourly/ntpdate
447 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
448 %{systemdunitdir}/ntpdate.service
449 %{_mandir}/man1/ntpdate.1*
450
451 %files -n mibs-ntp
452 %defattr(644,root,root,755)
453 %{mibdir}/ntpv4-mib.mib
454
455 %files -n net-snmp-ntpd
456 %defattr(644,root,root,755)
457 %doc ntpsnmpd/README
458 %attr(755,root,root) %{_sbindir}/ntpsnmpd
459 %{_mandir}/man1/ntpsnmpd.1*
460
461 %files tools
462 %defattr(644,root,root,755)
463 %attr(755,root,root) %{_sbindir}/calc_tickadj
464 %attr(755,root,root) %{_sbindir}/ntp-wait
465 %attr(755,root,root) %{_sbindir}/ntptrace
466 %dir %{_datadir}/ntp
467 %{_datadir}/ntp/lib
468 %{_mandir}/man1/calc_tickadj.1*
469 %{_mandir}/man1/ntp-wait.1*
470 %{_mandir}/man1/ntptrace.1*
471
472 %files doc-html
473 %defattr(644,root,root,755)
474 %doc html/*
This page took 0.083981 seconds and 4 git commands to generate.