]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.spec
325e51ba853ac93324a419fefe46b2c6fc621c00
[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:        3
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 Source10:       %{name}date-wrapper
29 Source11:       %{name}d.service
30 Source12:       %{name}date.service
31 Source13:       http://www.ietf.org/timezones/data/leap-seconds.list
32 # Source13-md5: e99a84cf28b14c77fba76c05565604ac
33 Patch0:         %{name}-build.patch
34 Patch1:         %{name}-no_libelf.patch
35 Patch2:         %{name}-ipv6.patch
36 Patch3:         %{name}-nano.patch
37 Patch4:         %{name}-no_avahi.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 Patch107:       %{name}-4.2.6p1-retcode.patch
45 Patch108:       %{name}-4.2.6p1-rtnetlink.patch
46 Patch110:       %{name}-logdefault.patch
47 Patch111:       %{name}-4.2.6p1-mlock.patch
48 URL:            http://www.ntp.org/
49 BuildRequires:  autoconf
50 BuildRequires:  autogen-devel
51 BuildRequires:  automake
52 %{?with_avahi:BuildRequires:    avahi-compat-libdns_sd-devel}
53 BuildRequires:  libcap-devel
54 BuildRequires:  libevent-devel
55 BuildRequires:  libnl-devel
56 BuildRequires:  libseccomp-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 ntpdate
142 Summary:        Utility to set the date and time via NTP
143 Summary(pl.UTF-8):      Klient do synchronizacji czasu po NTP (Network Time Protocol)
144 Group:          Applications/Networking
145 Requires(post,preun):   /sbin/chkconfig
146 Requires(postun):       /usr/sbin/groupdel
147 Requires(postun):       /usr/sbin/userdel
148 Requires(pre):  /bin/id
149 Requires(pre):  /usr/bin/getgid
150 Requires(pre):  /usr/sbin/groupadd
151 Requires(pre):  /usr/sbin/useradd
152 Requires(post,preun,postun):    systemd-units >= 38
153 Requires:       rc-scripts >= 0.4.3.0
154 Requires:       systemd-units >= 38
155 Provides:       group(ntp)
156 Provides:       user(ntp)
157 Conflicts:      ntp < 4.2.0-3
158 # for upgrades
159 Provides:       ntp-client = %{version}-%{release}
160 Obsoletes:      ntp-client < 4.2.4p8-6
161 # virtual
162 Provides:       ntpclient
163 Obsoletes:      ntpclient
164
165 %description -n ntpdate
166 ntpdate is a program for retrieving the date and time from NTP
167 servers.
168
169 %description -n ntpdate -l pl.UTF-8
170 Klient do synchronizacji czasu po NTP (Network Time Protocol).
171
172 %package -n mibs-ntp
173 Summary:        MIBs for NTP time entities
174 Summary(pl.UTF-8):      Pliki MIB dla elementów czasu NTP
175 Group:          Applications/System
176 Requires:       mibs-dirs
177
178 %description -n mibs-ntp
179 The Management Information Base for NTP time entities.
180
181 %description -n mibs-ntp -l pl.UTF-8
182 Pliki MIB (Management Information Base) dla elementów czasu NTP
183
184 %package -n net-snmp-ntpd
185 Summary:        NTP SNMP subagent for Net-SNMP
186 Summary(pl.UTF-8):      Podagent SNMP NTP dla usługi Net-SNMP
187 Group:          Daemons
188 Requires(post,preun):   /sbin/chkconfig
189 Requires:       net-snmp
190 Requires:       rc-scripts
191 Suggests:       mibs-ntp
192
193 %description -n net-snmp-ntpd
194 NTP SNMP AgentX subagent for Net-SNMP.
195
196 %description -n net-snmp-ntpd -l pl.UTF-8
197 Podagent SNMP AgentX NTP dla usługi Net-SNMP.
198
199 %package tools
200 Summary:        NTP tools
201 Summary(pl.UTF-8):      Narzędzia NTP
202 Group:          Applications/Networking
203 Obsoletes:      ntp-ntptrace
204
205 %description tools
206 This package contains NTP tools:
207 - ntptrace: Trace a chain of NTP servers back to the primary source
208 - ntp-wait: Wait for NTP server to synchronize
209 - calc_tickadj: Calculate optimal value for tick given ntp drift file
210
211 %description tools -l pl.UTF-8
212 Ten pakiet zawiera narzędzia NTP:
213 - ntptrace: śledzenie łańcucha serwerów NTP aż do oryginalnego źródła
214 - ntp-wait: oczekiwanie na synchronizację serwera NTP
215 - calc_tickadj: obliczenie optymalnej wartości dla pliku dryfu ntp
216
217 %package doc-html
218 Summary:        HTML documentation for ntp
219 Summary(pl.UTF-8):      Dokumentacja HTML dla ntp
220 Summary(pt_BR.UTF-8):   Documentação adicional para o pacote ntp
221 Group:          Documentation
222
223 %description doc-html
224 HTML documentation for ntp.
225
226 %description doc-html -l pl.UTF-8
227 Dokumentacja do ntp w HTML.
228
229 %description doc-html -l pt_BR.UTF-8
230 Este pacote contém documentação adicional sobre o NTP versão 4.
231
232 %prep
233 %setup -q -a7
234 %patch0 -p1
235 %patch1 -p1
236 %patch2 -p1
237 %patch3 -p1
238 %{!?with_avahi:%patch4 -p1}
239
240 ## FC patches
241 #%patch101 -p1
242 %patch102 -p1
243 #%patch103 -p1
244 %patch104 -p1
245 %patch105 -p1
246 %patch107 -p1
247 %patch108 -p1
248 %patch110 -p1
249 #%patch111 -p1  -- obsolete?
250
251 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
252 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
253
254 %{__rm} sntp/m4/{lt*,libtool}.m4 sntp/libevent/m4/{lt*,libtool}.m4
255
256 %build
257 %{__libtoolize}
258 %{__aclocal} -I sntp/m4 -I sntp/libopts/m4 -I sntp/libevent/m4
259 %{__autoconf}
260 %{__automake}
261 cd sntp
262 %{__libtoolize}
263 %{__aclocal} -I libopts/m4 -I libevent/m4
264 %{__autoconf}
265 %{__automake}
266 cd ..
267
268 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
269 %configure \
270         --with-binsubdir=sbin \
271         --enable-linuxcaps \
272         --enable-getifaddrs \
273         --enable-libseccomp \
274         --enable-ipv6 \
275         --enable-ntp-signd \
276         --with-lineeditlibs=readline \
277         --with-crypto=openssl \
278         --disable-local-libopts \
279         --disable-local-libevent
280
281 %{__make} -j1
282
283 %install
284 rm -rf $RPM_BUILD_ROOT
285 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
286         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
287         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly}
288
289 %{__make} install \
290         DESTDIR=$RPM_BUILD_ROOT
291
292 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.conf
293 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/keys
294 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/ntp.leapseconds
295
296 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpd
297 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntpdate
298 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
299 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
300
301 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
302 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
303 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
304 echo 'ntpd.service' > \
305         $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
306
307 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
308
309 install -d $RPM_BUILD_ROOT/var/lib/ntp
310 touch $RPM_BUILD_ROOT/var/lib/ntp/drift
311
312 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
313 #!/bin/sh
314 # Source function library.
315 . /etc/rc.d/init.d/functions
316
317 # Source ntpdate configuration
318 . /etc/sysconfig/ntpdate
319
320 is_yes "$NTPDATE_CRON" || exit 0
321 exec %{_sbindir}/ntpdate-wrapper
322 EOF
323
324 install -d $RPM_BUILD_ROOT%{mibdir}
325 cp -p ntpsnmpd/ntpv4-mib.mib $RPM_BUILD_ROOT%{mibdir}
326
327 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/{ntp4,sntp}
328
329 %clean
330 rm -rf $RPM_BUILD_ROOT
331
332 %pre -n ntpd
333 %groupadd -g 246 ntp
334 %useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
335
336 %post -n ntpd
337 /sbin/chkconfig --add ntpd
338 %service ntpd restart "NTP Daemon"
339 %systemd_post ntpd.service
340
341 %preun -n ntpd
342 if [ "$1" = "0" ]; then
343         %service ntpd stop
344         /sbin/chkconfig --del ntpd
345         rm -f /var/lib/ntp/drift
346 fi
347 %systemd_preun ntpd.service
348
349 %postun -n ntp
350 if [ "$1" = "0" ]; then
351         %userremove ntp
352         %groupremove ntp
353 fi
354 %systemd_reload
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 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
380 # Prevent preun from ntp from working
381 chmod a-x /etc/rc.d/init.d/ntpd
382
383 %triggerpostun -n ntpd -- ntp < 4.2.4p8-3.14
384 # Restore what triggerun removed
385 chmod 754 /etc/rc.d/init.d/ntpd
386 sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
387 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
388 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
389 %service -q ntpd restart
390 %systemd_trigger ntpd.service
391 %systemd_post ntpdate
392
393 %triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
394 %systemd_trigger ntpd.service
395
396 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
397 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
398         cp -f /etc/sysconfig/ntpdate{,.rpmnew}
399         mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
400 fi
401 %systemd_trigger ntpdate.service
402
403 %triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
404 %systemd_trigger ntpdate.service
405
406 %files -n ntpd
407 %defattr(644,root,root,755)
408 %doc NEWS TODO WHERE-TO-START conf/*.conf COPYRIGHT
409 %attr(750,root,root) %dir %{_sysconfdir}
410 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/keys
411 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.conf
412 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntp.leapseconds
413 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
414 %attr(754,root,root) /etc/rc.d/init.d/ntpd
415 %{systemdunitdir}/ntpd.service
416 # dir not handled by systemd in pld
417 #%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
418 %attr(755,root,root) %{_sbindir}/ntpd
419 %attr(755,root,root) %{_sbindir}/ntpdc
420 %attr(755,root,root) %{_sbindir}/ntp-keygen
421 %attr(755,root,root) %{_sbindir}/ntpq
422 %attr(755,root,root) %{_sbindir}/ntptime
423 %attr(755,root,root) %{_sbindir}/sntp
424 %attr(755,root,root) %{_sbindir}/tickadj
425 %{_mandir}/man1/ntpd.1*
426 %{_mandir}/man1/ntpdc.1*
427 %{_mandir}/man1/ntp-keygen.1*
428 %{_mandir}/man1/ntpq.1*
429 %{_mandir}/man1/ntptime.1*
430 %{_mandir}/man1/sntp.1*
431 %{_mandir}/man5/ntp.conf.5*
432 %{_mandir}/man5/ntp.keys.5*
433
434 %dir %attr(770,root,ntp) /var/lib/ntp
435 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
436
437 %files -n ntpdate
438 %defattr(644,root,root,755)
439 %doc COPYRIGHT
440 %attr(755,root,root) %{_sbindir}/ntpdate
441 %attr(755,root,root) %{_sbindir}/ntpdate-wrapper
442 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
443 %attr(754,root,root) /etc/cron.hourly/ntpdate
444 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
445 %{systemdunitdir}/ntpdate.service
446 %{_mandir}/man1/ntpdate.1*
447
448 %files -n mibs-ntp
449 %defattr(644,root,root,755)
450 %{mibdir}/ntpv4-mib.mib
451
452 %files -n net-snmp-ntpd
453 %defattr(644,root,root,755)
454 %doc ntpsnmpd/README
455 %attr(755,root,root) %{_sbindir}/ntpsnmpd
456 %{_mandir}/man1/ntpsnmpd.1*
457
458 %files tools
459 %defattr(644,root,root,755)
460 %attr(755,root,root) %{_sbindir}/calc_tickadj
461 %attr(755,root,root) %{_sbindir}/ntp-wait
462 %attr(755,root,root) %{_sbindir}/ntptrace
463 %dir %{_datadir}/ntp
464 %{_datadir}/ntp/lib
465 %{_mandir}/man1/calc_tickadj.1*
466 %{_mandir}/man1/ntp-wait.1*
467 %{_mandir}/man1/ntptrace.1*
468
469 %files doc-html
470 %defattr(644,root,root,755)
471 %doc html/*
This page took 0.101963 seconds and 2 git commands to generate.