]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
rel 1, seems working
[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
9 %include        /usr/lib/rpm/macros.perl
10 Summary:        Network Time Protocol utilities
11 Summary(pl.UTF-8):      Narzędzia do synchronizacji czasu (Network Time Protocol)
12 Summary(pt_BR.UTF-8):   Network Time Protocol versão 4
13 Name:           ntp
14 Version:        4.2.8
15 Release:        1
16 License:        distributable
17 Group:          Networking/Daemons
18 Source0:        http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
19 # Source0-md5:  6972a626be6150db8cfbd0b63d8719e7
20 Source1:        %{name}.conf
21 Source2:        %{name}.keys
22 Source3:        %{name}d.init
23 Source4:        %{name}d.sysconfig
24 Source5:        %{name}date.init
25 Source6:        %{name}date.sysconfig
26 Source7:        %{name}-manpages.tar.gz
27 # Source7-md5:  208fcc9019e19ab26d28e4597290bffb
28 Source8:        %{name}.upstart
29 Source9:        %{name}date.upstart
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: e99a84cf28b14c77fba76c05565604ac
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
52 BuildRequires:  autogen-devel
53 BuildRequires:  automake
54 %{?with_avahi:BuildRequires:    avahi-compat-libdns_sd-devel}
55 BuildRequires:  libcap-devel
56 BuildRequires:  libevent-devel
57 BuildRequires:  libnl-devel
58 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 ntpd-upstart
144 Summary:        Upstart job description for the NTP daemon
145 Summary(pl.UTF-8):      Opis zadania Upstart dla demona NTP
146 Group:          Daemons
147 Requires:       ntpd = %{version}-%{release}
148 Requires:       upstart >= 0.6
149
150 %description -n ntpd-upstart
151 Upstart job description for the NTP daemon.
152
153 %description -n ntpd-upstart -l pl.UTF-8
154 Opis zadania Upstart dla demona NTP.
155
156 %package -n ntpdate
157 Summary:        Utility to set the date and time via NTP
158 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
159 Group:          Applications/Networking
160 Requires(post,preun):   /sbin/chkconfig
161 Requires(postun):       /usr/sbin/groupdel
162 Requires(postun):       /usr/sbin/userdel
163 Requires(pre):  /bin/id
164 Requires(pre):  /usr/bin/getgid
165 Requires(pre):  /usr/sbin/groupadd
166 Requires(pre):  /usr/sbin/useradd
167 Requires(post,preun,postun):    systemd-units >= 38
168 Requires:       rc-scripts >= 0.4.3.0
169 Requires:       systemd-units >= 38
170 Provides:       group(ntp)
171 Provides:       user(ntp)
172 Conflicts:      ntp < 4.2.0-3
173 # for upgrades
174 Provides:       ntp-client = %{version}-%{release}
175 Obsoletes:      ntp-client < 4.2.4p8-6
176 # virtual
177 Provides:       ntpclient
178 Obsoletes:      ntpclient
179
180 %description -n ntpdate
181 ntpdate is a program for retrieving the date and time from NTP
182 servers.
183
184 %description -n ntpdate -l pl.UTF-8
185 Klient do synchronizacji czasu po NTP (Network Time Protocol).
186
187 %package -n ntpdate-upstart
188 Summary:        Upstart job description for NTP client
189 Summary(pl.UTF-8):      Opis zadania Upstart dla klienta NTP
190 Group:          Daemons
191 Requires:       ntpdate = %{version}-%{release}
192 Requires:       upstart >= 0.6
193
194 %description -n ntpdate-upstart
195 Upstart job description for the NTP client.
196
197 %description -n ntpdate-upstart -l pl.UTF-8
198 Opis zadania Upstart dla klienta NTP.
199
200 %package -n mibs-ntp
201 Summary:        MIBs for NTP time entities
202 Summary(pl.UTF-8):      Pliki MIB dla elementów czasu NTP
203 Group:          Applications/System
204 Requires:       mibs-dirs
205
206 %description -n mibs-ntp
207 The Management Information Base for NTP time entities.
208
209 %description -n mibs-ntp -l pl.UTF-8
210 Pliki MIB (Management Information Base) dla elementów czasu NTP
211
212 %package -n net-snmp-ntpd
213 Summary:        NTP SNMP subagent for Net-SNMP
214 Summary(pl.UTF-8):      Podagent SNMP NTP dla usługi Net-SNMP
215 Group:          Daemons
216 Requires(post,preun):   /sbin/chkconfig
217 Requires:       net-snmp
218 Requires:       rc-scripts
219 Suggests:       mibs-ntp
220
221 %description -n net-snmp-ntpd
222 NTP SNMP AgentX subagent for Net-SNMP.
223
224 %description -n net-snmp-ntpd -l pl.UTF-8
225 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
226
227 %package tools
228 Summary:        NTP tools
229 Summary(pl.UTF-8):      Narzędzia NTP
230 Group:          Applications/Networking
231 Obsoletes:      ntp-ntptrace
232
233 %description tools
234 This package contains NTP tools:
235 - ntptrace: Trace a chain of NTP servers back to the primary source
236 - ntp-wait: Wait for NTP server to synchronize
237 - calc_tickadj: Calculate optimal value for tick given ntp drift file
238
239 %description tools -l pl.UTF-8
240 Ten pakiet zawiera narzędzia NTP:
241 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
242 - ntp-wait: oczekiwanie na synchronizację serwera NTP
243 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
244
245 %package doc-html
246 Summary:        HTML documentation for ntp
247 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
248 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
249 Group:          Documentation
250
251 %description doc-html
252 HTML documentation for ntp.
253
254 %description doc-html -l pl.UTF-8
255 Dokumentacja do ntp w HTML.
256
257 %description doc-html -l pt_BR.UTF-8
258 Este pacote contém documentação adicional sobre o NTP versão 4.
259
260 %prep
261 %setup -q -a7
262 %patch0 -p1
263 %patch1 -p1
264 %patch2 -p1
265 %patch3 -p1
266 %{!?with_avahi:%patch4 -p1}
267
268 ## FC patches
269 #%patch101 -p1
270 %patch102 -p1
271 #%patch103 -p1
272 %patch104 -p1
273 %patch105 -p1
274 %patch107 -p1
275 %patch108 -p1
276 %patch110 -p1
277 #%patch111 -p1  -- obsolete?
278
279 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
280 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
281
282 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
283
284 %build
285 %{__libtoolize}
286 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
287 %{__autoconf}
288 %{__automake}
289 cd sntp
290 %{__libtoolize}
291 %{__aclocal} -I libopts/m4 -I libevent/m4
292 %{__autoconf}
293 %{__automake}
294 cd ..
295
296 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
297 %configure \
298         --with-binsubdir=sbin \
299         --enable-linuxcaps \
300         --enable-getifaddrs \
301         --enable-libseccomp \
302         --enable-ipv6 \
303         --enable-ntp-signd \
304         --with-lineeditlibs=readline \
305         --with-crypto=openssl \
306         --disable-local-libopts \
307         --disable-local-libevent
308
309 %{__make}
310
311 %install
312 rm -rf $RPM_BUILD_ROOT
313 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
314         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
315         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly,init}
316
317 %{__make} install \
318         DESTDIR=$RPM_BUILD_ROOT
319
320 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
321 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
322 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.leapseconds
323
324 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
325 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
326 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
327 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
328 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/init/ntpd.conf
329 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/init/ntpdate.conf
330
331 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
332 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
333 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
334 echo 'ntpd.service' > \
335         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
336
337 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
338
339 install -d $RPM_BUILD_ROOT/var/lib/ntp
340 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
341
342 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
343 #!/bin/sh
344 # Source function library.
345 . /etc/rc.d/init.d/functions
346
347 # Source ntpdate configuration
348 . /etc/sysconfig/ntpdate
349
350 is_yes "$NTPDATE_CRON" || exit 0
351 exec %{_sbindir}/ntpdate-wrapper
352 EOF
353
354 install -d $RPM_BUILD_ROOT%{mibdir}
355 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
356
357 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp4,sntp}
358
359 %clean
360 rm -rf $RPM_BUILD_ROOT
361
362 %pre -n ntpd
363 %groupadd -g 246 ntp
364 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
365
366 %post -n ntpd
367 /sbin/chkconfig --add ntpd
368 %service ntpd restart "NTP Daemon"
369 %systemd_post ntpd.service
370
371 %preun -n ntpd
372 if [ "$1" = "0" ]; then
373         %service ntpd stop
374         /sbin/chkconfig --del ntpd
375         rm -f /var/lib/ntp/drift
376 fi
377 %systemd_preun ntpd.service
378
379 %postun -n ntp
380 if [ "$1" = "0" ]; then
381         %userremove ntp
382         %groupremove ntp
383 fi
384 %systemd_reload
385
386 %post -n ntpd-upstart
387 %upstart_post ntpd
388
389 %postun -n ntpd-upstart
390 %upstart_postun ntpd
391
392 %pre -n ntpdate
393 %groupadd -g 246 ntp
394 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
395
396 %post -n ntpdate
397 /sbin/chkconfig --add ntpdate
398 %service ntpdate restart "NTP Date"
399 %systemd_post ntpdate.service
400
401 %preun -n ntpdate
402 if [ "$1" = "0" ]; then
403         %service ntpdate stop
404         /sbin/chkconfig --del ntpdate
405 fi
406 %systemd_preun ntpdate.service
407
408 %postun -n ntpdate
409 if [ "$1" = "0" ]; then
410         %userremove ntp
411         %groupremove ntp
412 fi
413 %systemd_reload
414
415 %post -n ntpdate-upstart
416 %upstart_post ntpdate
417
418 %postun -n ntpdate-upstart
419 %upstart_postun ntpdate
420
421 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
422 # Prevent preun from ntp from working
423 chmod a-x /etc/rc.d/init.d/ntpd
424
425 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
426 # Restore what triggerun removed
427 chmod 754 /etc/rc.d/init.d/ntpd
428 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
429 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
430 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
431 %service -q ntpd restart
432 %systemd_trigger ntpd.service
433 %systemd_post ntpdate
434
435 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
436 %systemd_trigger ntpd.service
437
438 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
439 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
440         cp -f /etc/sysconfig/ntpdate{,.rpmnew}
441         mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
442 fi
443 %systemd_trigger ntpdate.service
444
445 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
446 %systemd_trigger ntpdate.service
447
448 %files -n ntpd
449 %defattr(644,root,root,755)
450 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
451 %attr(750,root,root) %dir %{_sysconfdir}
452 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/keys
453 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.conf
454 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.leapseconds
455 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
456 %attr(754,root,root) /etc/rc.d/init.d/ntpd
457 %{systemdunitdir}/ntpd.service
458 # dir not handled by systemd in pld
459 #%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
460 %attr(755,root,root) %{_sbindir}/ntpd
461 %attr(755,root,root) %{_sbindir}/ntpdc
462 %attr(755,root,root) %{_sbindir}/ntp-keygen
463 %attr(755,root,root) %{_sbindir}/ntpq
464 %attr(755,root,root) %{_sbindir}/ntptime
465 %attr(755,root,root) %{_sbindir}/sntp
466 %attr(755,root,root) %{_sbindir}/tickadj
467 %{_mandir}/man1/ntpd.1*
468 %{_mandir}/man1/ntpdc.1*
469 %{_mandir}/man1/ntp-keygen.1*
470 %{_mandir}/man1/ntpq.1*
471 %{_mandir}/man1/ntptime.1*
472 %{_mandir}/man1/sntp.1*
473 %{_mandir}/man5/ntp.conf.5*
474 %{_mandir}/man5/ntp.keys.5*
475
476 %dir %attr(770,root,ntp) /var/lib/ntp
477 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
478
479 %files -n ntpd-upstart
480 %defattr(644,root,root,755)
481 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpd.conf
482
483 %files -n ntpdate
484 %defattr(644,root,root,755)
485 %doc COPYRIGHT
486 %attr(755,root,root) %{_sbindir}/ntpdate
487 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
488 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
489 %attr(754,root,root) /etc/cron.hourly/ntpdate
490 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
491 %{systemdunitdir}/ntpdate.service
492 %{_mandir}/man1/ntpdate.1*
493
494 %files -n ntpdate-upstart
495 %defattr(644,root,root,755)
496 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpdate.conf
497
498 %files -n mibs-ntp
499 %defattr(644,root,root,755)
500 %{mibdir}/ntpv4-mib.mib
501
502 %files -n net-snmp-ntpd
503 %defattr(644,root,root,755)
504 %doc ntpsnmpd/README
505 %attr(755,root,root) %{_sbindir}/ntpsnmpd
506 %{_mandir}/man1/ntpsnmpd.1*
507
508 %files tools
509 %defattr(644,root,root,755)
510 %attr(755,root,root) %{_sbindir}/calc_tickadj
511 %attr(755,root,root) %{_sbindir}/ntp-wait
512 %attr(755,root,root) %{_sbindir}/ntptrace
513 %dir %{_datadir}/ntp
514 %{_datadir}/ntp/lib
515 %{_mandir}/man1/calc_tickadj.1*
516 %{_mandir}/man1/ntp-wait.1*
517 %{_mandir}/man1/ntptrace.1*
518
519 %files doc-html
520 %defattr(644,root,root,755)
521 %doc html/*
This page took 0.068278 seconds and 4 git commands to generate.