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