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