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