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