]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp.spec
3334b83897d2a919ea6740641cd64ce7b661a3b2
[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 BuildArch:      noarch
105
106 %description -n openldap-schema-dhcp
107 This package contains LDAPv3 schema for use with the DHCP Server.
108
109 %description -n openldap-schema-dhcp -l pl.UTF-8
110 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
111
112 %package client
113 Summary:        DHCP Client
114 Summary(pl.UTF-8):      Klient DHCP
115 Group:          Networking/Daemons
116 Requires:       coreutils
117 Requires:       iproute2
118 Requires:       net-tools
119 Suggests:       avahi-autoipd
120 Provides:       dhclient = %{epoch}:%{version}-%{release}
121 Obsoletes:      dhclient
122 Obsoletes:      dhcpv6-client
123 Obsoletes:      libdhcp4client
124 Obsoletes:      libdhcp4client-devel
125 Obsoletes:      libdhcp4client-static
126
127 %description client
128 Dynamic Host Configuration Protocol Client.
129
130 %description client -l pl.UTF-8
131 Klient DHCP (Dynamic Host Configuration Protocol).
132
133 %package client-dirs
134 Summary:        DHCP Client common dirs
135 Summary(pl.UTF-8):      Katalogi klienta DHCP
136 Group:          Networking/Daemons
137
138 %description client-dirs
139 Directories for scripts for dhcp-client.
140
141 %description client-dirs -l pl.UTF-8
142 Katalog przeznaczony na skrypty dla klienta dhcp.
143
144 %package relay
145 Summary:        DHCP Relay Agent
146 Summary(pl.UTF-8):      Agent przekazywania informacji DHCP
147 Group:          Networking/Daemons
148 Requires(post): coreutils
149 Requires(post,preun):   /sbin/chkconfig
150 Requires:       rc-scripts >= 0.2.0
151 Obsoletes:      dhcpv6-relay
152
153 %description relay
154 Dhcp relay is a relay agent for DHCP packets. It is used on a subnet
155 with DHCP clients to "relay" their requests to a subnet that has a
156 DHCP server on it. Because DHCP packets can be broadcast, they will
157 not be routed off of the local subnet. The DHCP relay takes care of
158 this for the client.
159
160 %description relay -l pl.UTF-8
161 Agent przekazywania DHCP (Dynamic Host Configuration Protocol) między
162 podsieciami. Ponieważ komunikaty DHCP mogą być przekazywane w formie
163 rozgłoszeniowej, bez tego agenta nie zostaną przerutowane do innej
164 podsieci.
165
166 %package devel
167 Summary:        DHCP development includes and libs
168 Summary(pl.UTF-8):      Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
169 Group:          Development/Libraries
170
171 %description devel
172 Includes OMAPI and dhcptl libraries.
173
174 OMAPI is an programming layer designed for controlling remote
175 applications, and for querying them for their state. It is currently
176 used by the ISC DHCP server.
177
178 The dhcpctl set of functions provide an API that can be used to
179 communicate with and manipulate a running ISC DHCP server.
180
181 %description devel -l pl.UTF-8
182 Zawiera biblioteki OMAPI oraz dhcpctl.
183
184 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
185 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
186
187 dhcpctl to zbiór funkcji tworzących API, które może być używane do
188 komunikacji z działającym serwerem ISC DHCP i jego kontroli.
189
190 %prep
191 %setup -q -n %{name}-%{ver}%{pverdir}
192 %patch0 -p1
193 # This patch is required for dhcdbd to function
194 # CHECK ME: adds -x (formerly -y):
195 #The -x argument enables extended option information to be created in the
196 #-s dhclient-script environment, which would allow applications running
197 #in that environment to handle options they do not know about in advance -
198 #this is a Red Hat extension to support dhcdbd and NetworkManager.
199 # however, fedora doesn't have this patch anymore, so can drop?
200 #%%patch1 -p1
201 %patch2 -p1
202 %patch3 -p1
203 %patch4 -p1
204 %patch5 -p1
205 %patch6 -p1
206 %patch7 -p1
207 %patch8 -p1
208 %patch9 -p1
209 %patch10 -p1
210 %patch11 -p1
211
212 # Copy in documentation and example scripts for LDAP patch to dhcpd
213 cp -a %{SOURCE11} README.ldap
214 cp -a %{SOURCE12} doc
215 cp -a %{SOURCE13} contrib
216
217 # Replace @PRODUCTNAME@
218 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
219 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
220
221 # Update paths in all man pages
222 for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do
223         %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
224                         -e 's|RUNDIR|%{_localstatedir}/run|g' \
225                         -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
226                         -e 's|ETCDIR|%{_sysconfdir}|g' $page
227 done
228
229 for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do
230         %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
231                                 -e 's|RUNDIR|%{_localstatedir}/run|g' \
232                                 -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
233                                 -e 's|ETCDIR|%{_sysconfdir}|g' $page
234 done
235
236 %build
237 %{__libtoolize}
238 %{__aclocal}
239 %{__autoconf}
240 %{__autoheader}
241 %{__automake}
242 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
243 %configure \
244         %{!?with_static_libs:--disable-static} \
245         --enable-dhcpv6 \
246         --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
247         --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
248         --with-srv-pid-file=/var/run/dhcpd.pid \
249         --with-cli-pid-file=/var/run/dhclient.pid \
250         --with-relay-pid-file=/var/run/dhcrelay.pid \
251         --with%{!?with_ldap:out}-ldap
252 %{__make} -j1
253
254 %install
255 rm -rf $RPM_BUILD_ROOT
256 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,dhclient-enter-hooks.d,dhclient-exit-hooks.d},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}}
257
258 %{__make} install \
259         DESTDIR=$RPM_BUILD_ROOT
260
261 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd
262 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6
263 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay
264 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
265 install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
266
267 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
268
269 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
270 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
271
272 %if %{with ldap}
273 install -d $RPM_BUILD_ROOT%{schemadir}
274 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
275 %endif
276
277 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
278
279 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
280 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
281
282 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
283 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
284
285 %if %{with static_libs}
286 # HACK: strip doesn't like .a inside .a
287 install -d stripworkdir
288 cd stripworkdir
289 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
290         archives=$(ar t $a | grep '\.a$' || :)
291         [ "$archives" ] || continue
292
293         # hope we don't have to recurse here
294         for ar in $archives; do
295                 rm -f *.o *.a
296                 ar x $a $ar
297                 ar x $ar
298                 ar d $a $ar
299                 ar cr $a *.o
300         done
301 done
302 cd -
303 %endif
304
305 %clean
306 rm -rf $RPM_BUILD_ROOT
307
308 %post
309 touch /var/lib/dhcpd/dhcpd.leases
310 touch /var/lib/dhcpd/dhcpd6.leases
311 /sbin/chkconfig --add dhcpd
312 %service dhcpd restart "dhcpd daemon"
313 /sbin/chkconfig --add dhcpd6
314 %service dhcpd6 restart "dhcpd IPv6 daemon"
315
316 %preun
317 if [ "$1" = "0" ];then
318         %service dhcpd stop
319         /sbin/chkconfig --del dhcpd
320         %service dhcpd6 stop
321         /sbin/chkconfig --del dhcpd6
322 fi
323
324 %triggerpostun -- dhcp < 3.0
325 if ! grep -q ddns-update-style /etc/dhcpd.conf; then
326         %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf
327 fi
328
329 %post -n openldap-schema-dhcp
330 %openldap_schema_register %{schemadir}/dhcp.schema -d core
331 %service -q ldap restart
332
333 %postun -n openldap-schema-dhcp
334 if [ "$1" = "0" ]; then
335         %openldap_schema_unregister %{schemadir}/dhcp.schema
336         %service -q ldap restart
337 fi
338
339 %post relay
340 /sbin/chkconfig --add dhcp-relay
341 if [ -f /var/lock/subsys/dhcrelay ]; then
342         mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
343 fi
344 %service dhcp-relay restart "dhcrelay daemon"
345
346 %preun relay
347 if [ "$1" = "0" ];then
348         %service dhcp-relay stop
349         /sbin/chkconfig --del dhcp-relay
350 fi
351
352 %triggerun client -- %{name}-client < 4:4.0.2-2
353 if [ -f /etc/dhclient-enter-hooks ] ; then
354         mv /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.d/
355 fi
356 if [ -f /etc/dhclient-exit-hooks ] ; then
357         mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
358 fi
359
360 %files
361 %defattr(644,root,root,755)
362 %doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
363 %doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
364 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
365 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
366 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd6.conf
367 %attr(755,root,root) %{_bindir}/omshell
368 %attr(755,root,root) %{_sbindir}/dhcpd
369 %attr(754,root,root) /etc/rc.d/init.d/dhcpd
370 %attr(754,root,root) /etc/rc.d/init.d/dhcpd6
371 %attr(750,root,root) %dir /var/lib/dhcpd
372 %ghost /var/lib/dhcpd/dhcpd.leases
373 %ghost /var/lib/dhcpd/dhcpd6.leases
374 %{_mandir}/man1/omshell.1*
375 %{_mandir}/man5/dhcp-eval.5*
376 %{_mandir}/man5/dhcp-options.5*
377 %{_mandir}/man5/dhcpd.conf.5*
378 %{_mandir}/man5/dhcpd.leases.5*
379 %{_mandir}/man8/dhcpd.8*
380
381 %files client
382 %defattr(644,root,root,755)
383 %doc contrib/sethostname.sh client/dhclient.conf.example
384 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
385 %attr(755,root,root) /sbin/dhclient
386 %attr(755,root,root) /sbin/dhclient-script
387 %{_mandir}/man5/dhclient.conf.5*
388 %{_mandir}/man5/dhclient.leases.5*
389 %{_mandir}/man8/dhclient.8*
390 %{_mandir}/man8/dhclient-script.8*
391 %dir %attr(750,root,root) /var/lib/dhclient
392 %ghost /var/lib/dhclient/dhclient.leases
393 %ghost /var/lib/dhclient/dhclient6.leases
394
395 %files client-dirs
396 %defattr(644,root,root,755)
397 %dir %{_sysconfdir}/dhclient-enter-hooks.d
398 %dir %{_sysconfdir}/dhclient-exit-hooks.d
399
400 %files relay
401 %defattr(644,root,root,755)
402 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay
403 %attr(755,root,root) %{_sbindir}/dhcrelay
404 %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay
405 %{_mandir}/man8/dhcrelay.8*
406
407 %files devel
408 %defattr(644,root,root,755)
409 %{_libdir}/libdhcpctl.a
410 %{_libdir}/libomapi.a
411 %{_includedir}/dhcpctl
412 %{_includedir}/isc-dhcp
413 %{_includedir}/omapip
414 %{_mandir}/man3/dhcpctl.3*
415 %{_mandir}/man3/omapi.3*
416
417 %if %{with ldap}
418 %files -n openldap-schema-dhcp
419 %defattr(644,root,root,755)
420 %{schemadir}/dhcp.schema
421 %endif
This page took 0.070948 seconds and 2 git commands to generate.