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