]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp.spec
b64f6fd8b113091e72581e7c9f498d07b72dfe8e
[packages/dhcp.git] / dhcp.spec
1 #
2 # Conditional build:
3 %bcond_without  ldap    # without support for ldap storage
4 %bcond_without  static_libs     # don't build static library
5 %bcond_without  systemd         # without systemd units
6
7 %define         ver     4.4.3
8 %if 0
9 %define         pverdot .P1
10 %define         pverdir -P1
11 %else
12 %define         pverdot %{nil}
13 %define         pverdir %{nil}
14 %endif
15
16 # vendor string
17 %define vvendor PLD/Linux
18 Summary:        DHCP Server
19 Summary(es.UTF-8):      Servidor DHCP
20 Summary(pl.UTF-8):      Serwer DHCP
21 Summary(pt_BR.UTF-8):   Servidor DHCP (Protocolo de configuração dinâmica de hosts)
22 Name:           dhcp
23 Version:        %{ver}%{pverdot}
24 Release:        2
25 Epoch:          4
26 License:        MIT
27 Group:          Networking/Daemons
28 Source0:        ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
29 # Source0-md5:  9076af4cc1293dde5a7c6cae7de6ab45
30 Source1:        %{name}.init
31 Source2:        %{name}6.init
32 Source3:        %{name}-relay.init
33 Source4:        %{name}.sysconfig
34 Source5:        %{name}-relay.sysconfig
35 Source6:        dhcpd.service
36 Source7:        dhcpd6.service
37 Source8:        dhcp-relay.service
38 Source10:       %{name}.schema
39 Source11:       %{name}-README.ldap
40 Source12:       draft-ietf-dhc-ldap-schema-01.txt
41 Source13:       %{name}d-conf-to-ldap
42 Patch0:         %{name}-release-by-ifup.patch
43 Patch1:         %{name}-3.0.3-x-option.patch
44 Patch2:         %{name}-paths.patch
45 Patch3:         %{name}-timeouts.patch
46 Patch4:         %{name}-options.patch
47 Patch5:         %{name}-errwarn-message.patch
48 Patch6:         %{name}-memory.patch
49 Patch7:         %{name}-unicast-bootp.patch
50 Patch8:         %{name}-default-requested-options.patch
51 Patch9:         %{name}-manpages.patch
52 Patch10:        %{name}-extravars.patch
53 Patch11:        systemd-notify.patch
54 Patch12:        %{name}-CLOEXEC.patch
55 Patch13:        %{name}-garbage-in-format-string-error.patch
56 Patch14:        %{name}-handle-null-timouet.patch
57 Patch15:        %{name}-capabilities.patch
58 Patch16:        %{name}-rfc3442-classless-static-routes.patch
59 Patch17:        %{name}-ppp.patch
60 Patch18:        %{name}-lpf-ib.patch
61 Patch19:        %{name}-add-guid-duid-to-logs.patch
62 Patch20:        %{name}-duid_uuid.patch
63 Patch21:        %{name}-client-request-release-bind-iface.patch
64 Patch22:        %{name}-no-subnet-error2info.patch
65 Patch23:        %{name}-stateless-duid-llt.patch
66 Patch24:        %{name}-hwaddress.patch
67 Patch25:        %{name}-confparse.patch
68 Patch26:        %{name}-link-local-address.patch
69 Patch27:        %{name}-option97-pxe-client-id.patch
70 Patch28:        %{name}-detect-time-changes.patch
71 Patch29:        bind-detect-time-changes.patch
72 Patch30:        bind-system-getaddrinfo.patch
73 URL:            https://www.isc.org/dhcp/
74 BuildRequires:  autoconf
75 BuildRequires:  automake
76 BuildRequires:  groff
77 %ifarch %{arm}
78 BuildRequires:  libatomic-devel
79 %endif
80 BuildRequires:  libtool
81 %{?with_ldap:BuildRequires:     openldap-devel}
82 %{?with_ldap:BuildRequires:     openssl-devel}
83 BuildRequires:  rpmbuild(macros) >= 1.644
84 %{?with_systemd:BuildRequires:  systemd-devel}
85 Requires(post): coreutils
86 Requires(post,preun):   /sbin/chkconfig
87 Requires:       rc-scripts >= 0.2.0
88 %{?with_systemd:Requires:       systemd-units >= 38}
89 Provides:       dhcpd
90 Obsoletes:      dhcpv6-server
91 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
92
93 %define         _sbindir        /sbin
94 %define         schemadir       /usr/share/openldap/schema
95
96 %description
97 DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
98 individual devices on an IP network to get their own network
99 configuration information (IP address, subnetmask, broadcast address,
100 etc.) from a DHCP server. The overall purpose of DHCP is to make it
101 easier to administer a large network.
102
103 %description -l es.UTF-8
104 DHCP permite que hosts en una red TCP/IP soliciten y tengan sus
105 direcciones IP alocadas dinámicamente, permite también descubrir
106 información sobre la red en que están conectados. BOOTP provee una
107 funcionalidad similar, con ciertas restricciones. Este servidor
108 también las atiende.
109
110 %description -l pl.UTF-8
111 Serwer DHCP (Dynamic Host Configuration Protocol).
112
113 DHCP to protokół pozwalający urządzeniom pracującym w sieci IP na
114 pobieranie ich konfiguracji IP (adresu, maski podsieci, adresu
115 rozgłoszeniowego itp.) z serwera DHCP. Ułatwia on administrowanie
116 dużymi sieciami IP.
117
118 %description -l pt_BR.UTF-8
119 DHCP permite que hosts numa rede TCP/IP requisitem e tenham seus
120 endereços IP alocados dinamicamente, permite também descobrir
121 informações sobre a rede em que estão conectados. BOOTP provê uma
122 funcionalidade similar, com certas restrições. Este servidor também
123 atende aquelas requisições. Esta versão é ainda considerada um
124 software BETA.
125
126 %package -n openldap-schema-dhcp
127 Summary:        LDAP Schema for DHCP Server
128 Summary(pl.UTF-8):      Schemat LDAP dla serwera DHCP
129 Group:          Networking/Daemons
130 Requires(post,postun):  sed >= 4.0
131 Requires:       openldap-servers
132 BuildArch:      noarch
133
134 %description -n openldap-schema-dhcp
135 This package contains LDAPv3 schema for use with the DHCP Server.
136
137 %description -n openldap-schema-dhcp -l pl.UTF-8
138 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
139
140 %package client
141 Summary:        DHCP Client
142 Summary(pl.UTF-8):      Klient DHCP
143 Group:          Networking/Daemons
144 Requires:       bash
145 Requires:       coreutils
146 Requires:       grep
147 Requires:       hostname
148 Requires:       iproute2
149 Requires:       sed
150 Requires:       util-linux
151 Suggests:       avahi-autoipd
152 Provides:       dhclient = %{epoch}:%{version}-%{release}
153 Obsoletes:      dhclient
154 Obsoletes:      dhcpv6-client
155 Obsoletes:      libdhcp4client
156 Obsoletes:      libdhcp4client-devel
157 Obsoletes:      libdhcp4client-static
158
159 %description client
160 Dynamic Host Configuration Protocol Client.
161
162 %description client -l pl.UTF-8
163 Klient DHCP (Dynamic Host Configuration Protocol).
164
165 %package client-dirs
166 Summary:        DHCP Client common dirs
167 Summary(pl.UTF-8):      Katalogi klienta DHCP
168 Group:          Networking/Daemons
169
170 %description client-dirs
171 Directories for scripts for dhcp-client.
172
173 %description client-dirs -l pl.UTF-8
174 Katalog przeznaczony na skrypty dla klienta dhcp.
175
176 %package relay
177 Summary:        DHCP Relay Agent
178 Summary(pl.UTF-8):      Agent przekazywania informacji DHCP
179 Group:          Networking/Daemons
180 Requires(post): coreutils
181 Requires(post,preun):   /sbin/chkconfig
182 Requires:       rc-scripts >= 0.2.0
183 Obsoletes:      dhcpv6-relay
184
185 %description relay
186 Dhcp relay is a relay agent for DHCP packets. It is used on a subnet
187 with DHCP clients to "relay" their requests to a subnet that has a
188 DHCP server on it. Because DHCP packets can be broadcast, they will
189 not be routed off of the local subnet. The DHCP relay takes care of
190 this for the client.
191
192 %description relay -l pl.UTF-8
193 Agent przekazywania DHCP (Dynamic Host Configuration Protocol) między
194 podsieciami. Ponieważ komunikaty DHCP mogą być przekazywane w formie
195 rozgłoszeniowej, bez tego agenta nie zostaną przerutowane do innej
196 podsieci.
197
198 %package devel
199 Summary:        DHCP development includes and libs
200 Summary(pl.UTF-8):      Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
201 Group:          Development/Libraries
202
203 %description devel
204 Includes OMAPI and dhcptl libraries.
205
206 OMAPI is an programming layer designed for controlling remote
207 applications, and for querying them for their state. It is currently
208 used by the ISC DHCP server.
209
210 The dhcpctl set of functions provide an API that can be used to
211 communicate with and manipulate a running ISC DHCP server.
212
213 %description devel -l pl.UTF-8
214 Zawiera biblioteki OMAPI oraz dhcpctl.
215
216 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
217 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
218
219 dhcpctl to zbiór funkcji tworzących API, które może być używane do
220 komunikacji z działającym serwerem ISC DHCP i jego kontroli.
221
222 %prep
223 %setup -q -n %{name}-%{ver}%{pverdir}
224 %patch0 -p1
225 # This patch is required for dhcdbd to function
226 # CHECK ME: adds -x (formerly -y):
227 #The -x argument enables extended option information to be created in the
228 #-s dhclient-script environment, which would allow applications running
229 #in that environment to handle options they do not know about in advance -
230 #this is a Red Hat extension to support dhcdbd and NetworkManager.
231 # however, fedora doesn't have this patch anymore, so can drop?
232 #%%patch1 -p1
233 %patch2 -p1
234 %patch3 -p1
235 %patch4 -p1
236 %patch5 -p1
237 %patch6 -p1
238 %patch7 -p1
239 %patch8 -p1
240 %patch9 -p1
241 %patch10 -p1
242 %patch11 -p1
243 %patch12 -p1
244 %patch13 -p1
245 %patch14 -p1
246 %patch15 -p1
247 %patch16 -p1
248 %patch17 -p1
249 %patch18 -p1
250 %patch19 -p1
251 %patch20 -p1
252 %patch21 -p1
253 %patch22 -p1
254 %patch23 -p1
255 %patch24 -p1
256 %patch25 -p1
257 %patch26 -p1
258 %patch27 -p1
259 %patch28 -p1
260
261 cd bind
262 tar -xvf bind.tar.gz
263 ln -s bind-9* bind
264 cd ..
265
266 %patch29 -p1
267 %patch30 -p1
268
269 # Copy in documentation and example scripts for LDAP patch to dhcpd
270 cp -a %{SOURCE11} README.ldap
271 cp -a %{SOURCE12} doc
272 cp -a %{SOURCE13} contrib
273
274 # Replace @PRODUCTNAME@
275 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
276 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
277
278 # Update paths in all man pages
279 for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do
280         %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
281                         -e 's|RUNDIR|%{_localstatedir}/run|g' \
282                         -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
283                         -e 's|ETCDIR|%{_sysconfdir}|g' $page
284 done
285
286 for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do
287         %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
288                                 -e 's|RUNDIR|%{_localstatedir}/run|g' \
289                                 -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
290                                 -e 's|ETCDIR|%{_sysconfdir}|g' $page
291 done
292
293 %build
294 %{__libtoolize}
295 %{__aclocal}
296 %{__autoconf}
297 %{__autoheader}
298 %{__automake}
299 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
300 %configure \
301 %ifarch %{arm}
302         LIBS="-latomic" \
303 %endif
304         %{!?with_static_libs:--disable-static} \
305         --enable-dhcpv6 \
306         --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
307         --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
308         --with-srv-pid-file=/var/run/dhcpd.pid \
309         --with-cli-pid-file=/var/run/dhclient.pid \
310         --with-relay-pid-file=/var/run/dhcrelay.pid \
311         --with%{!?with_ldap:out}-ldap \
312         --with%{!?with_systemd:out}-systemd
313 %{__make} -j1
314
315 %install
316 rm -rf $RPM_BUILD_ROOT
317 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,dhclient-enter-hooks.d,dhclient-exit-hooks.d},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}}
318
319 %{__make} install \
320         DESTDIR=$RPM_BUILD_ROOT
321
322 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd
323 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6
324 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay
325 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
326 install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
327
328 %if %{with systemd}
329 install -d $RPM_BUILD_ROOT%{systemdunitdir}
330 cp -p %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{systemdunitdir}
331 %endif
332
333 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
334
335 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
336 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
337
338 %if %{with ldap}
339 install -d $RPM_BUILD_ROOT%{schemadir}
340 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
341 %endif
342
343 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
344
345 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
346 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
347
348 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
349 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
350
351 %if %{with static_libs}
352 # HACK: strip doesn't like .a inside .a
353 install -d stripworkdir
354 cd stripworkdir
355 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
356         archives=$(ar t $a | grep '\.a$' || :)
357         [ "$archives" ] || continue
358
359         # hope we don't have to recurse here
360         for ar in $archives; do
361                 rm -f *.o *.a
362                 ar x $a $ar
363                 ar x $ar
364                 ar d $a $ar
365                 ar cr $a *.o
366         done
367 done
368 cd -
369 %endif
370
371 %clean
372 rm -rf $RPM_BUILD_ROOT
373
374 %post
375 touch /var/lib/dhcpd/dhcpd.leases
376 touch /var/lib/dhcpd/dhcpd6.leases
377 /sbin/chkconfig --add dhcpd
378 %service dhcpd restart "dhcpd daemon"
379 /sbin/chkconfig --add dhcpd6
380 %service dhcpd6 restart "dhcpd IPv6 daemon"
381 %{?with_systemd:%systemd_post dhcpd.service dhcpd6.service}
382
383 %preun
384 if [ "$1" = "0" ];then
385         %service dhcpd stop
386         /sbin/chkconfig --del dhcpd
387         %service dhcpd6 stop
388         /sbin/chkconfig --del dhcpd6
389 fi
390 %{?with_systemd:%systemd_preun dhcpd.service dhcpd6.service}
391
392 %postun
393 %{?with_systemd:%systemd_reload}
394
395 %triggerpostun -- dhcp < 4.4.2-2
396 if ! grep -q ddns-update-style /etc/dhcpd.conf; then
397         %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf
398 fi
399 %systemd_trigger dhcpd.service dhcpd6.service
400
401 %post -n openldap-schema-dhcp
402 %openldap_schema_register %{schemadir}/dhcp.schema -d core
403 %service -q ldap restart
404
405 %postun -n openldap-schema-dhcp
406 if [ "$1" = "0" ]; then
407         %openldap_schema_unregister %{schemadir}/dhcp.schema
408         %service -q ldap restart
409 fi
410
411 %post relay
412 /sbin/chkconfig --add dhcp-relay
413 if [ -f /var/lock/subsys/dhcrelay ]; then
414         mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
415 fi
416 %service dhcp-relay restart "dhcrelay daemon"
417 %{?with_systemd:%systemd_post dhcp-relay.service}
418
419 %preun relay
420 if [ "$1" = "0" ];then
421         %service dhcp-relay stop
422         /sbin/chkconfig --del dhcp-relay
423 fi
424 %{?with_systemd:%systemd_preun dhcp-relay.service}
425
426 %postun relay
427 %{?with_systemd:%systemd_reload}
428
429 %triggerpostun -- dhcp-relay < 4.4.2-2
430 %systemd_trigger dhcp-relay.service
431
432 %triggerun client -- %{name}-client < 4:4.0.2-2
433 if [ -f /etc/dhclient-enter-hooks ] ; then
434         mv /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.d/
435 fi
436 if [ -f /etc/dhclient-exit-hooks ] ; then
437         mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
438 fi
439
440 %files
441 %defattr(644,root,root,755)
442 %doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
443 %doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
444 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
445 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
446 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd6.conf
447 %attr(755,root,root) %{_bindir}/omshell
448 %attr(755,root,root) %{_sbindir}/dhcpd
449 %attr(754,root,root) /etc/rc.d/init.d/dhcpd
450 %attr(754,root,root) /etc/rc.d/init.d/dhcpd6
451 %if %{with systemd}
452 %{systemdunitdir}/dhcpd.service
453 %{systemdunitdir}/dhcpd6.service
454 %endif
455 %attr(750,root,root) %dir /var/lib/dhcpd
456 %ghost /var/lib/dhcpd/dhcpd.leases
457 %ghost /var/lib/dhcpd/dhcpd6.leases
458 %{_mandir}/man1/omshell.1*
459 %{_mandir}/man5/dhcp-eval.5*
460 %{_mandir}/man5/dhcp-options.5*
461 %{_mandir}/man5/dhcpd.conf.5*
462 %{_mandir}/man5/dhcpd.leases.5*
463 %{_mandir}/man8/dhcpd.8*
464
465 %files client
466 %defattr(644,root,root,755)
467 %doc contrib/sethostname.sh client/dhclient.conf.example
468 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
469 %attr(755,root,root) /sbin/dhclient
470 %attr(755,root,root) /sbin/dhclient-script
471 %{_mandir}/man5/dhclient.conf.5*
472 %{_mandir}/man5/dhclient.leases.5*
473 %{_mandir}/man8/dhclient.8*
474 %{_mandir}/man8/dhclient-script.8*
475 %dir %attr(750,root,root) /var/lib/dhclient
476 %ghost /var/lib/dhclient/dhclient.leases
477 %ghost /var/lib/dhclient/dhclient6.leases
478
479 %files client-dirs
480 %defattr(644,root,root,755)
481 %dir %{_sysconfdir}/dhclient-enter-hooks.d
482 %dir %{_sysconfdir}/dhclient-exit-hooks.d
483
484 %files relay
485 %defattr(644,root,root,755)
486 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay
487 %attr(755,root,root) %{_sbindir}/dhcrelay
488 %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay
489 %{?with_systemd:%{systemdunitdir}/dhcp-relay.service}
490 %{_mandir}/man8/dhcrelay.8*
491
492 %files devel
493 %defattr(644,root,root,755)
494 %{_libdir}/libdhcp.a
495 %{_libdir}/libdhcpctl.a
496 %{_libdir}/libomapi.a
497 %{_includedir}/dhcpctl
498 %{_includedir}/omapip
499 %{_mandir}/man3/dhcpctl.3*
500 %{_mandir}/man3/omapi.3*
501
502 %if %{with ldap}
503 %files -n openldap-schema-dhcp
504 %defattr(644,root,root,755)
505 %{schemadir}/dhcp.schema
506 %endif
This page took 0.069923 seconds and 2 git commands to generate.