]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
- fixes for build with -Werror=format-security option
[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 Patch5:         %{name}-format-security.patch
38 # FC patches + 100
39 Patch101:       %{name}-4.2.6p1-sleep.patch
40 Patch102:       %{name}-4.2.6p1-droproot.patch
41 Patch103:       %{name}-4.2.6p1-bcast.patch
42 Patch104:       %{name}-4.2.6p1-cmsgalign.patch
43 Patch105:       %{name}-4.2.6p1-linkfastmath.patch
44 Patch106:       %{name}-4.2.6p1-tentative.patch
45 Patch107:       %{name}-4.2.6p1-retcode.patch
46 Patch108:       %{name}-4.2.6p1-rtnetlink.patch
47 Patch109:       %{name}-4.2.4p7-getprecision.patch
48 Patch110:       %{name}-4.2.6p1-logdefault.patch
49 Patch111:       %{name}-4.2.6p1-mlock.patch
50 Patch112:       %{name}-4.2.6p3-broadcastdelay.patch
51 Patch113:       %{name}-4.2.6p3-delaycalib.patch
52 URL:            http://www.ntp.org/
53 BuildRequires:  autoconf
54 BuildRequires:  automake
55 %{?with_avahi:BuildRequires:    avahi-compat-libdns_sd-devel}
56 BuildRequires:  libcap-devel
57 BuildRequires:  libnl-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 ntpd-upstart
143 Summary:        Upstart job description for the NTP daemon
144 Summary(pl.UTF-8):      Opis zadania Upstart dla demona NTP
145 Group:          Daemons
146 Requires:       ntpd = %{version}-%{release}
147 Requires:       upstart >= 0.6
148
149 %description -n ntpd-upstart
150 Upstart job description for the NTP daemon.
151
152 %description -n ntpd-upstart -l pl.UTF-8
153 Opis zadania Upstart dla demona NTP.
154
155 %package -n ntpdate
156 Summary:        Utility to set the date and time via NTP
157 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
158 Group:          Applications/Networking
159 Requires(post,preun):   /sbin/chkconfig
160 Requires(postun):       /usr/sbin/groupdel
161 Requires(postun):       /usr/sbin/userdel
162 Requires(pre):  /bin/id
163 Requires(pre):  /usr/bin/getgid
164 Requires(pre):  /usr/sbin/groupadd
165 Requires(pre):  /usr/sbin/useradd
166 Requires(post,preun,postun):    systemd-units >= 38
167 Requires:       rc-scripts >= 0.4.3.0
168 Requires:       systemd-units >= 38
169 Provides:       group(ntp)
170 Provides:       user(ntp)
171 Conflicts:      ntp < 4.2.0-3
172 # for upgrades
173 Provides:       ntp-client = %{version}-%{release}
174 Obsoletes:      ntp-client < 4.2.4p8-6
175 # virtual
176 Provides:       ntpclient
177 Obsoletes:      ntpclient
178
179 %description -n ntpdate
180 ntpdate is a program for retrieving the date and time from NTP
181 servers.
182
183 %description -n ntpdate -l pl.UTF-8
184 Klient do synchronizacji czasu po NTP (Network Time Protocol).
185
186 %package -n ntpdate-upstart
187 Summary:        Upstart job description for NTP client
188 Summary(pl.UTF-8):      Opis zadania Upstart dla klienta NTP
189 Group:          Daemons
190 Requires:       ntpdate = %{version}-%{release}
191 Requires:       upstart >= 0.6
192
193 %description -n ntpdate-upstart
194 Upstart job description for the NTP client.
195
196 %description -n ntpdate-upstart -l pl.UTF-8
197 Opis zadania Upstart dla klienta NTP.
198
199 %package -n mibs-ntp
200 Summary:        MIBs for NTP time entities
201 Group:          Applications/System
202 Requires:       mibs-dirs
203
204 %description -n mibs-ntp
205 The Management Information Base for NTP time entities.
206
207 %package -n net-snmp-ntpd
208 Summary:        NTP SNMP subagent for Net-SNMP
209 Group:          Daemons
210 Requires(post,preun):   /sbin/chkconfig
211 Requires:       net-snmp
212 Requires:       rc-scripts
213 Suggests:       mibs-ntp
214
215 %description -n net-snmp-ntpd
216 NTP SNMP AgentX subagent for Net-SNMP.
217
218 %package tools
219 Summary:        NTP tools
220 Group:          Applications/Networking
221 Obsoletes:      ntp-ntptrace
222
223 %description tools
224 This package contains ntp tools:
225 - ntptrace: Trace a chain of NTP servers back to the primary source
226 - ntp-wait: Wait for NTP server to synchronize
227
228 %package doc-html
229 Summary:        HTML documentation for ntp
230 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
231 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
232 Group:          Documentation
233
234 %description doc-html
235 HTML documentation for ntp.
236
237 %description doc-html -l pl.UTF-8
238 Dokumentacja do ntp w HTML.
239
240 %description doc-html -l pt_BR.UTF-8
241 Este pacote contém documentação adicional sobre o NTP versão 4.
242
243 %prep
244 %setup -q -a7
245 %patch0 -p1
246 %patch1 -p1
247 %patch2 -p1
248 %patch3 -p1
249 %{!?with_avahi:%patch4 -p1}
250 %patch5 -p1
251
252 ## FC patches
253 %patch101 -p1
254 %patch102 -p1
255 %patch103 -p1
256 %patch104 -p1
257 %patch105 -p1
258 %patch106 -p1
259 %patch107 -p1
260 %patch108 -p1
261 %patch109 -p1
262 %patch110 -p1
263 %patch111 -p1
264 %patch112 -p1
265 %patch113 -p1
266
267 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
268 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
269
270 %build
271 %{__libtoolize}
272 %{__aclocal} -I m4 -I sntp/libopts/m4
273 %{__autoconf}
274 %{__automake}
275 cd sntp
276 %{__libtoolize}
277 %{__aclocal} -I ../m4 -I libopts/m4
278 %{__autoconf}
279 %{__automake}
280 cd ..
281
282 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
283 %configure \
284         --with-binsubdir=sbin \
285         --enable-linuxcaps \
286         --enable-getifaddrs \
287         --enable-ipv6 \
288         --with-lineeditlibs=readline \
289         --with-crypto=openssl
290
291 %{__make}
292
293 %install
294 rm -rf $RPM_BUILD_ROOT
295 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
296         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly,init}
297
298 %{__make} install \
299         DESTDIR=$RPM_BUILD_ROOT
300
301 cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
302 cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
303 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
304 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
305 cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
306 cp -a %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
307 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/init/ntpd.conf
308 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/init/ntpdate.conf
309
310 install %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
311 install %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
312 install %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
313
314 cp -a man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
315
316 install -d $RPM_BUILD_ROOT/var/lib/ntp
317 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
318
319 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
320 #!/bin/sh
321 exec /usr/sbin/ntpdate-wrapper
322 EOF
323
324 install -d $RPM_BUILD_ROOT%{mibdir}
325 cp -a ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
326
327 %clean
328 rm -rf $RPM_BUILD_ROOT
329
330 %pre -n ntpd
331 %groupadd -g 246 ntp
332 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
333
334 %post -n ntpd
335 /sbin/chkconfig --add ntpd
336 %service ntpd restart "NTP Daemon"
337 %systemd_post ntpd.service
338
339 %preun -n ntpd
340 if [ "$1" = "0" ]; then
341         %service ntpd stop
342         /sbin/chkconfig --del ntpd
343         rm -f /var/lib/ntp/drift
344 fi
345 %systemd_preun ntpd.service
346
347 %postun -n ntp
348 if [ "$1" = "0" ]; then
349         %userremove ntp
350         %groupremove ntp
351 fi
352 %systemd_reload
353
354 %post -n ntpd-upstart
355 %upstart_post ntpd
356
357 %postun -n ntpd-upstart
358 %upstart_postun ntpd
359
360 %pre -n ntpdate
361 %groupadd -g 246 ntp
362 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
363
364 %post -n ntpdate
365 /sbin/chkconfig --add ntpdate
366 %service ntpdate restart "NTP Date"
367 %systemd_post ntpdate.service
368
369 %preun -n ntpdate
370 if [ "$1" = "0" ]; then
371         %service ntpdate stop
372         /sbin/chkconfig --del ntpdate
373 fi
374 %systemd_preun ntpdate.service
375
376 %postun -n ntpdate
377 if [ "$1" = "0" ]; then
378         %userremove ntp
379         %groupremove ntp
380 fi
381 %systemd_reload
382
383 %post -n ntpdate-upstart
384 %upstart_post ntpdate
385
386 %postun -n ntpdate-upstart
387 %upstart_postun ntpdate
388
389 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
390 # Prevent preun from ntp from working
391 chmod a-x /etc/rc.d/init.d/ntpd
392
393 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
394 # Restore what triggerun removed
395 chmod 754 /etc/rc.d/init.d/ntpd
396 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
397 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
398 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
399 %service -q ntpd restart
400 %systemd_trigger ntpd.service
401 %systemd_post ntpdate
402
403 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
404 %systemd_trigger ntpd.service
405
406 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
407 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
408         cp -f /etc/sysconfig/ntpdate{,.rpmnew}
409         mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
410 fi
411 %systemd_trigger ntpdate.service
412
413 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
414 %systemd_trigger ntpdate.service
415
416 %files -n ntpd
417 %defattr(644,root,root,755)
418 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
419 %attr(750,root,root) %dir %{_sysconfdir}
420 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
421 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
422 %attr(754,root,root) /etc/rc.d/init.d/ntpd
423 %{systemdunitdir}/ntpd.service
424 %attr(755,root,root) %{_sbindir}/ntpd
425 %attr(755,root,root) %{_sbindir}/ntpdc
426 %attr(755,root,root) %{_sbindir}/ntp-keygen
427 %attr(755,root,root) %{_sbindir}/ntpq
428 %attr(755,root,root) %{_sbindir}/ntptime
429 %attr(755,root,root) %{_sbindir}/sntp
430 %attr(755,root,root) %{_sbindir}/tickadj
431 %{_mandir}/man1/ntpd.1*
432 %{_mandir}/man1/ntpdc.1*
433 %{_mandir}/man1/ntp-keygen.1*
434 %{_mandir}/man1/ntpq.1*
435 %{_mandir}/man1/ntptime.1*
436 %{_mandir}/man1/sntp.1*
437
438 %dir %attr(770,root,ntp) /var/lib/ntp
439 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
440
441 %files -n ntpd-upstart
442 %defattr(644,root,root,755)
443 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpd.conf
444
445 %files -n ntpdate
446 %defattr(644,root,root,755)
447 %doc COPYRIGHT
448 %attr(755,root,root) %{_sbindir}/ntpdate
449 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
450 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
451 %attr(754,root,root) /etc/cron.hourly/ntpdate
452 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
453 %{systemdunitdir}/ntpdate.service
454 %{_mandir}/man1/ntpdate*
455
456 %files -n ntpdate-upstart
457 %defattr(644,root,root,755)
458 %config(noreplace) %verify(not md5 mtime size) /etc/init/ntpdate.conf
459
460 %files -n mibs-ntp
461 %defattr(644,root,root,755)
462 %{mibdir}/ntpv4-mib.mib
463
464 %files -n net-snmp-ntpd
465 %defattr(644,root,root,755)
466 %doc ntpsnmpd/README
467 %attr(755,root,root) %{_sbindir}/ntpsnmpd
468 %{_mandir}/man1/ntpsnmpd.1*
469
470 %files tools
471 %defattr(644,root,root,755)
472 %attr(755,root,root) %{_sbindir}/ntptrace
473 %attr(755,root,root) %{_sbindir}/ntp-wait
474 %{_mandir}/man1/ntptrace*
475
476 %files doc-html
477 %defattr(644,root,root,755)
478 %doc html/*
This page took 0.123611 seconds and 3 git commands to generate.