]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
- rel 3
[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:        3
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:       rc-scripts >= 0.4.3.0
105 Requires:       systemd-units >= 37-0.10
106 Provides:       group(ntp)
107 Provides:       ntp = %{version}-%{release}
108 Provides:       ntpdaemon
109 Provides:       user(ntp)
110 Obsoletes:      ntp < 4.2.4p8-6
111 Obsoletes:      ntpdaemon
112 Obsoletes:      openntpd
113 Obsoletes:      xntp3
114
115 %description -n ntpd
116 The Network Time Protocol (NTP) is used to synchronize a computer's
117 time with another reference time source. The ntp package contains
118 utilities and daemons which will synchronize your computer's time to
119 Coordinated Universal Time (UTC) via the NTP protocol and NTP servers.
120
121 This package includes ntpd (a daemon which continuously adjusts system
122 time)
123
124 %description -n ntpd -l pl.UTF-8
125 Network Time Protocol (NTP) służy do synchronizacji czasu komputera z
126 innym, wzorcowym źródłem czasu. Pakiet ntp zawiera narzędzia i demony
127 służące do dokładnego synchronizowania czasu komputera według czasu
128 uniwersalnego (UTC) poprzez protokół NTP z serwerami NTP.
129
130 Pakiet ntp zawiera ntpd (demona, który w sposób ciągły aktualizuje
131 czas systemowy)
132
133 %description -n ntpd -l pt_BR.UTF-8
134 Esta é a versão 4 do Network Time Protocol (NTP). Este protocolo é
135 utilizado para sincronizar o relógio do computador com uma outra
136 referência de horário. Este pacote contém utilitários e servidores que
137 sincronizarão o relógio do seu computador com o horário universal
138 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
139
140 %package -n ntpd-upstart
141 Summary:        Upstart job description for the NTP daemon
142 Summary(pl.UTF-8):      Opis zadania Upstart dla demona NTP
143 Group:          Daemons
144 Requires:       ntpd = %{version}-%{release}
145 Requires:       upstart >= 0.6
146
147 %description -n ntpd-upstart
148 Upstart job description for the NTP daemon.
149
150 %description -n ntpd-upstart -l pl.UTF-8
151 Opis zadania Upstart dla demona NTP.
152
153 %package -n ntpdate
154 Summary:        Utility to set the date and time via NTP
155 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
156 Group:          Applications/Networking
157 Requires(post,preun):   /sbin/chkconfig
158 Requires(postun):       /usr/sbin/groupdel
159 Requires(postun):       /usr/sbin/userdel
160 Requires(pre):  /bin/id
161 Requires(pre):  /usr/bin/getgid
162 Requires(pre):  /usr/sbin/groupadd
163 Requires(pre):  /usr/sbin/useradd
164 Requires:       rc-scripts >= 0.4.3.0
165 Requires:       systemd-units >= 37-0.10
166 Provides:       group(ntp)
167 Provides:       user(ntp)
168 Conflicts:      ntp < 4.2.0-3
169 # for upgrades
170 Provides:       ntp-client = %{version}-%{release}
171 Obsoletes:      ntp-client < 4.2.4p8-6
172 # virtual
173 Provides:       ntpclient
174 Obsoletes:      ntpclient
175
176 %description -n ntpdate
177 ntpdate is a program for retrieving the date and time from NTP
178 servers.
179
180 %description -n ntpdate -l pl.UTF-8
181 Klient do synchronizacji czasu po NTP (Network Time Protocol).
182
183 %package -n ntpdate-upstart
184 Summary:        Upstart job description for NTP client
185 Summary(pl.UTF-8):      Opis zadania Upstart dla klienta NTP
186 Group:          Daemons
187 Requires:       ntpdate = %{version}-%{release}
188 Requires:       upstart >= 0.6
189
190 %description -n ntpdate-upstart
191 Upstart job description for the NTP client.
192
193 %description -n ntpdate-upstart -l pl.UTF-8
194 Opis zadania Upstart dla klienta NTP.
195
196 %package -n mibs-ntp
197 Summary:        MIBs for NTP time entities
198 Group:          Applications/System
199 Requires:       mibs-dirs
200
201 %description -n mibs-ntp
202 The Management Information Base for NTP time entities.
203
204 %package -n net-snmp-ntpd
205 Summary:        NTP SNMP subagent for Net-SNMP
206 Group:          Daemons
207 Requires(post,preun):   /sbin/chkconfig
208 Requires:       net-snmp
209 Requires:       rc-scripts
210 Suggests:       mibs-ntp
211
212 %description -n net-snmp-ntpd
213 NTP SNMP AgentX subagent for Net-SNMP.
214
215 %package tools
216 Summary:        NTP tools
217 Group:          Applications/Networking
218 Obsoletes:      ntp-ntptrace
219
220 %description tools
221 This package contains ntp tools:
222 - ntptrace: Trace a chain of NTP servers back to the primary source
223 - ntp-wait: Wait for NTP server to synchronize
224
225 %package doc-html
226 Summary:        HTML documentation for ntp
227 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
228 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
229 Group:          Documentation
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 %patch106 -p1
255 %patch107 -p1
256 %patch108 -p1
257 %patch109 -p1
258 %patch110 -p1
259 %patch111 -p1
260 %patch112 -p1
261 %patch113 -p1
262
263 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
264 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
265
266 %build
267 %{__libtoolize}
268 %{__aclocal} -I m4 -I sntp/libopts/m4
269 %{__autoconf}
270 %{__automake}
271 cd sntp
272 %{__libtoolize}
273 %{__aclocal} -I ../m4 -I libopts/m4
274 %{__autoconf}
275 %{__automake}
276 cd ..
277
278 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
279 %configure \
280         --with-binsubdir=sbin \
281         --enable-linuxcaps \
282         --enable-getifaddrs \
283         --enable-ipv6 \
284         --with-lineeditlibs=readline \
285         --with-crypto=openssl
286
287 %{__make}
288
289 %install
290 rm -rf $RPM_BUILD_ROOT
291 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
292         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly,init}
293
294 %{__make} install \
295         DESTDIR=$RPM_BUILD_ROOT
296
297 cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
298 cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
299 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
300 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
301 cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
302 cp -a %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
303 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/init/ntpd.conf
304 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/init/ntpdate.conf
305
306 install %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
307 install %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
308 install %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
309
310 cp -a man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
311
312 install -d $RPM_BUILD_ROOT/var/lib/ntp
313 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
314
315 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
316 #!/bin/sh
317 exec /usr/sbin/ntpdate-wrapper
318 EOF
319
320 install -d $RPM_BUILD_ROOT%{mibdir}
321 cp -a ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
322
323 %clean
324 rm -rf $RPM_BUILD_ROOT
325
326 %pre -n ntpd
327 %groupadd -g 246 ntp
328 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
329
330 %post -n ntpd
331 /sbin/chkconfig --add ntpd
332 %service ntpd restart "NTP Daemon"
333 %systemd_post ntpd.service
334
335 %preun -n ntpd
336 if [ "$1" = "0" ]; then
337         %service ntpd stop
338         /sbin/chkconfig --del ntpd
339         rm -f /var/lib/ntp/drift
340 fi
341 %systemd_preun ntpd.service
342
343 %postun -n ntp
344 if [ "$1" = "0" ]; then
345         %userremove ntp
346         %groupremove ntp
347 fi
348 %systemd_reload
349
350 %post -n ntpd-upstart
351 %upstart_post ntpd
352
353 %postun -n ntpd-upstart
354 %upstart_postun ntpd
355
356 %pre -n ntpdate
357 %groupadd -g 246 ntp
358 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
359
360 %post -n ntpdate
361 /sbin/chkconfig --add ntpdate
362 %service ntpdate restart "NTP Date"
363 %systemd_post ntpdate.service
364
365 %preun -n ntpdate
366 if [ "$1" = "0" ]; then
367         %service ntpdate stop
368         /sbin/chkconfig --del ntpdate
369 fi
370 %systemd_preun ntpdate.service
371
372 %postun -n ntpdate
373 if [ "$1" = "0" ]; then
374         %userremove ntp
375         %groupremove ntp
376 fi
377 %systemd_reload
378
379 %post -n ntpdate-upstart
380 %upstart_post ntpdate
381
382 %postun -n ntpdate-upstart
383 %upstart_postun ntpdate
384
385 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
386 # Prevent preun from ntp from working
387 chmod a-x /etc/rc.d/init.d/ntpd
388
389 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
390 # Restore what triggerun removed
391 chmod 754 /etc/rc.d/init.d/ntpd
392 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
393 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
394 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
395 %service -q ntpd restart
396 %systemd_trigger ntpd.service
397 %systemd_post ntpdate
398
399 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
400 %systemd_trigger ntpd.service
401
402 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
403 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
404         cp -f /etc/sysconfig/ntpdate{,.rpmnew}
405         mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
406 fi
407 %systemd_trigger ntpdate.service
408
409 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
410 %systemd_trigger ntpdate.service
411
412 %files -n ntpd
413 %defattr(644,root,root,755)
414 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
415 %attr(750,root,root) %dir %{_sysconfdir}
416 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
417 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
418 %attr(754,root,root) /etc/rc.d/init.d/ntpd
419 %{systemdunitdir}/ntpd.service
420 %attr(755,root,root) %{_sbindir}/ntpd
421 %attr(755,root,root) %{_sbindir}/ntpdc
422 %attr(755,root,root) %{_sbindir}/ntp-keygen
423 %attr(755,root,root) %{_sbindir}/ntpq
424 %attr(755,root,root) %{_sbindir}/ntptime
425 %attr(755,root,root) %{_sbindir}/sntp
426 %attr(755,root,root) %{_sbindir}/tickadj
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
434 %dir %attr(770,root,ntp) /var/lib/ntp
435 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
436
437 %files -n ntpd-upstart
438 %defattr(644,root,root,755)
439 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpd.conf
440
441 %files -n ntpdate
442 %defattr(644,root,root,755)
443 %doc COPYRIGHT
444 %attr(755,root,root) %{_sbindir}/ntpdate
445 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
446 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
447 %attr(754,root,root) /etc/cron.hourly/ntpdate
448 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
449 %{systemdunitdir}/ntpdate.service
450 %{_mandir}/man1/ntpdate*
451
452 %files -n ntpdate-upstart
453 %defattr(644,root,root,755)
454 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpdate.conf
455
456 %files -n mibs-ntp
457 %defattr(644,root,root,755)
458 %{mibdir}/ntpv4-mib.mib
459
460 %files -n net-snmp-ntpd
461 %defattr(644,root,root,755)
462 %doc ntpsnmpd/README
463 %attr(755,root,root) %{_sbindir}/ntpsnmpd
464 %{_mandir}/man1/ntpsnmpd.1*
465
466 %files tools
467 %defattr(644,root,root,755)
468 %attr(755,root,root) %{_sbindir}/ntptrace
469 %attr(755,root,root) %{_sbindir}/ntp-wait
470 %{_mandir}/man1/ntptrace*
471
472 %files doc-html
473 %defattr(644,root,root,755)
474 %doc html/*
This page took 0.110728 seconds and 4 git commands to generate.