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