3 %bcond_without ldap # without support for ldap storage
4 %bcond_without static_libs # don't build static library
5 %bcond_without systemd # without systemd units
12 %define pverdot %{nil}
13 %define pverdir %{nil}
17 %define vvendor PLD/Linux
19 Summary(es.UTF-8): Servidor DHCP
20 Summary(pl.UTF-8): Serwer DHCP
21 Summary(pt_BR.UTF-8): Servidor DHCP (Protocolo de configuração dinâmica de hosts)
23 Version: %{ver}%{pverdot}
27 Group: Networking/Daemons
28 Source0: ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
29 # Source0-md5: 2afdaf8498dc1edaf3012efdd589b3e1
31 Source2: %{name}6.init
32 Source3: %{name}-relay.init
33 Source4: %{name}.sysconfig
34 Source5: %{name}-relay.sysconfig
35 Source6: dhcpd.service
36 Source7: dhcpd6.service
37 Source8: dhcp-relay.service
38 Source10: %{name}.schema
39 Source11: %{name}-README.ldap
40 Source12: draft-ietf-dhc-ldap-schema-01.txt
41 Source13: %{name}d-conf-to-ldap
42 Patch0: %{name}-release-by-ifup.patch
43 Patch1: %{name}-3.0.3-x-option.patch
44 Patch2: %{name}-paths.patch
45 Patch3: %{name}-timeouts.patch
46 Patch4: %{name}-options.patch
47 Patch5: %{name}-errwarn-message.patch
48 Patch6: %{name}-memory.patch
49 Patch7: %{name}-unicast-bootp.patch
50 Patch8: %{name}-default-requested-options.patch
51 Patch9: %{name}-manpages.patch
52 Patch10: %{name}-extravars.patch
53 Patch11: systemd-notify.patch
54 URL: https://www.isc.org/dhcp/
55 BuildRequires: autoconf
56 BuildRequires: automake
59 BuildRequires: libatomic-devel
61 BuildRequires: libtool
62 %{?with_ldap:BuildRequires: openldap-devel}
63 %{?with_ldap:BuildRequires: openssl-devel}
64 BuildRequires: rpmbuild(macros) >= 1.644
65 %{?with_systemd:BuildRequires: systemd-devel}
66 Requires(post): coreutils
67 Requires(post,preun): /sbin/chkconfig
68 Requires: rc-scripts >= 0.2.0
69 %{?with_systemd:Requires: systemd-units >= 38}
71 Obsoletes: dhcpv6-server
72 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
74 %define _sbindir /sbin
75 %define schemadir /usr/share/openldap/schema
78 DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
79 individual devices on an IP network to get their own network
80 configuration information (IP address, subnetmask, broadcast address,
81 etc.) from a DHCP server. The overall purpose of DHCP is to make it
82 easier to administer a large network.
84 %description -l es.UTF-8
85 DHCP permite que hosts en una red TCP/IP soliciten y tengan sus
86 direcciones IP alocadas dinámicamente, permite también descubrir
87 información sobre la red en que están conectados. BOOTP provee una
88 funcionalidad similar, con ciertas restricciones. Este servidor
91 %description -l pl.UTF-8
92 Serwer DHCP (Dynamic Host Configuration Protocol).
94 DHCP to protokół pozwalający urządzeniom pracującym w sieci IP na
95 pobieranie ich konfiguracji IP (adresu, maski podsieci, adresu
96 rozgłoszeniowego itp.) z serwera DHCP. Ułatwia on administrowanie
99 %description -l pt_BR.UTF-8
100 DHCP permite que hosts numa rede TCP/IP requisitem e tenham seus
101 endereços IP alocados dinamicamente, permite também descobrir
102 informações sobre a rede em que estão conectados. BOOTP provê uma
103 funcionalidade similar, com certas restrições. Este servidor também
104 atende aquelas requisições. Esta versão é ainda considerada um
107 %package -n openldap-schema-dhcp
108 Summary: LDAP Schema for DHCP Server
109 Summary(pl.UTF-8): Schemat LDAP dla serwera DHCP
110 Group: Networking/Daemons
111 Requires(post,postun): sed >= 4.0
112 Requires: openldap-servers
115 %description -n openldap-schema-dhcp
116 This package contains LDAPv3 schema for use with the DHCP Server.
118 %description -n openldap-schema-dhcp -l pl.UTF-8
119 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
123 Summary(pl.UTF-8): Klient DHCP
124 Group: Networking/Daemons
128 Suggests: avahi-autoipd
129 Provides: dhclient = %{epoch}:%{version}-%{release}
131 Obsoletes: dhcpv6-client
132 Obsoletes: libdhcp4client
133 Obsoletes: libdhcp4client-devel
134 Obsoletes: libdhcp4client-static
137 Dynamic Host Configuration Protocol Client.
139 %description client -l pl.UTF-8
140 Klient DHCP (Dynamic Host Configuration Protocol).
143 Summary: DHCP Client common dirs
144 Summary(pl.UTF-8): Katalogi klienta DHCP
145 Group: Networking/Daemons
147 %description client-dirs
148 Directories for scripts for dhcp-client.
150 %description client-dirs -l pl.UTF-8
151 Katalog przeznaczony na skrypty dla klienta dhcp.
154 Summary: DHCP Relay Agent
155 Summary(pl.UTF-8): Agent przekazywania informacji DHCP
156 Group: Networking/Daemons
157 Requires(post): coreutils
158 Requires(post,preun): /sbin/chkconfig
159 Requires: rc-scripts >= 0.2.0
160 Obsoletes: dhcpv6-relay
163 Dhcp relay is a relay agent for DHCP packets. It is used on a subnet
164 with DHCP clients to "relay" their requests to a subnet that has a
165 DHCP server on it. Because DHCP packets can be broadcast, they will
166 not be routed off of the local subnet. The DHCP relay takes care of
169 %description relay -l pl.UTF-8
170 Agent przekazywania DHCP (Dynamic Host Configuration Protocol) między
171 podsieciami. Ponieważ komunikaty DHCP mogą być przekazywane w formie
172 rozgłoszeniowej, bez tego agenta nie zostaną przerutowane do innej
176 Summary: DHCP development includes and libs
177 Summary(pl.UTF-8): Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
178 Group: Development/Libraries
181 Includes OMAPI and dhcptl libraries.
183 OMAPI is an programming layer designed for controlling remote
184 applications, and for querying them for their state. It is currently
185 used by the ISC DHCP server.
187 The dhcpctl set of functions provide an API that can be used to
188 communicate with and manipulate a running ISC DHCP server.
190 %description devel -l pl.UTF-8
191 Zawiera biblioteki OMAPI oraz dhcpctl.
193 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
194 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
196 dhcpctl to zbiór funkcji tworzących API, które może być używane do
197 komunikacji z działającym serwerem ISC DHCP i jego kontroli.
200 %setup -q -n %{name}-%{ver}%{pverdir}
202 # This patch is required for dhcdbd to function
203 # CHECK ME: adds -x (formerly -y):
204 #The -x argument enables extended option information to be created in the
205 #-s dhclient-script environment, which would allow applications running
206 #in that environment to handle options they do not know about in advance -
207 #this is a Red Hat extension to support dhcdbd and NetworkManager.
208 # however, fedora doesn't have this patch anymore, so can drop?
221 # Copy in documentation and example scripts for LDAP patch to dhcpd
222 cp -a %{SOURCE11} README.ldap
223 cp -a %{SOURCE12} doc
224 cp -a %{SOURCE13} contrib
226 # Replace @PRODUCTNAME@
227 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
228 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
230 # Update paths in all man pages
231 for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do
232 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
233 -e 's|RUNDIR|%{_localstatedir}/run|g' \
234 -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
235 -e 's|ETCDIR|%{_sysconfdir}|g' $page
238 for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do
239 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
240 -e 's|RUNDIR|%{_localstatedir}/run|g' \
241 -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
242 -e 's|ETCDIR|%{_sysconfdir}|g' $page
251 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
256 %{!?with_static_libs:--disable-static} \
258 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
259 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
260 --with-srv-pid-file=/var/run/dhcpd.pid \
261 --with-cli-pid-file=/var/run/dhclient.pid \
262 --with-relay-pid-file=/var/run/dhcrelay.pid \
263 --with%{!?with_ldap:out}-ldap \
264 --with%{!?with_systemd:out}-systemd
268 rm -rf $RPM_BUILD_ROOT
269 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,dhclient-enter-hooks.d,dhclient-exit-hooks.d},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}}
272 DESTDIR=$RPM_BUILD_ROOT
274 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd
275 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6
276 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay
277 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
278 install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
281 install -d $RPM_BUILD_ROOT%{systemdunitdir}
282 cp -p %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{systemdunitdir}
285 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
287 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
288 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
291 install -d $RPM_BUILD_ROOT%{schemadir}
292 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
295 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
297 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
298 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
300 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
301 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
303 %if %{with static_libs}
304 # HACK: strip doesn't like .a inside .a
305 install -d stripworkdir
307 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
308 archives=$(ar t $a | grep '\.a$' || :)
309 [ "$archives" ] || continue
311 # hope we don't have to recurse here
312 for ar in $archives; do
324 rm -rf $RPM_BUILD_ROOT
327 touch /var/lib/dhcpd/dhcpd.leases
328 touch /var/lib/dhcpd/dhcpd6.leases
329 /sbin/chkconfig --add dhcpd
330 %service dhcpd restart "dhcpd daemon"
331 /sbin/chkconfig --add dhcpd6
332 %service dhcpd6 restart "dhcpd IPv6 daemon"
333 %{?with_systemd:%systemd_post dhcpd.service dhcpd6.service}
336 if [ "$1" = "0" ];then
338 /sbin/chkconfig --del dhcpd
340 /sbin/chkconfig --del dhcpd6
342 %{?with_systemd:%systemd_preun dhcpd.service dhcpd6.service}
345 %{?with_systemd:%systemd_reload}
347 %triggerpostun -- dhcp < 4.4.2-2
348 if ! grep -q ddns-update-style /etc/dhcpd.conf; then
349 %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf
351 %systemd_trigger dhcpd.service dhcpd6.service
353 %post -n openldap-schema-dhcp
354 %openldap_schema_register %{schemadir}/dhcp.schema -d core
355 %service -q ldap restart
357 %postun -n openldap-schema-dhcp
358 if [ "$1" = "0" ]; then
359 %openldap_schema_unregister %{schemadir}/dhcp.schema
360 %service -q ldap restart
364 /sbin/chkconfig --add dhcp-relay
365 if [ -f /var/lock/subsys/dhcrelay ]; then
366 mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
368 %service dhcp-relay restart "dhcrelay daemon"
369 %{?with_systemd:%systemd_post dhcp-relay.service}
372 if [ "$1" = "0" ];then
373 %service dhcp-relay stop
374 /sbin/chkconfig --del dhcp-relay
376 %{?with_systemd:%systemd_preun dhcp-relay.service}
379 %{?with_systemd:%systemd_reload}
381 %triggerpostun -- dhcp-relay < 4.4.2-2
382 %systemd_trigger dhcp-relay.service
384 %triggerun client -- %{name}-client < 4:4.0.2-2
385 if [ -f /etc/dhclient-enter-hooks ] ; then
386 mv /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.d/
388 if [ -f /etc/dhclient-exit-hooks ] ; then
389 mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
393 %defattr(644,root,root,755)
394 %doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
395 %doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
396 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
397 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
398 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd6.conf
399 %attr(755,root,root) %{_bindir}/omshell
400 %attr(755,root,root) %{_sbindir}/dhcpd
401 %attr(754,root,root) /etc/rc.d/init.d/dhcpd
402 %attr(754,root,root) /etc/rc.d/init.d/dhcpd6
404 %{systemdunitdir}/dhcpd.service
405 %{systemdunitdir}/dhcpd6.service
407 %attr(750,root,root) %dir /var/lib/dhcpd
408 %ghost /var/lib/dhcpd/dhcpd.leases
409 %ghost /var/lib/dhcpd/dhcpd6.leases
410 %{_mandir}/man1/omshell.1*
411 %{_mandir}/man5/dhcp-eval.5*
412 %{_mandir}/man5/dhcp-options.5*
413 %{_mandir}/man5/dhcpd.conf.5*
414 %{_mandir}/man5/dhcpd.leases.5*
415 %{_mandir}/man8/dhcpd.8*
418 %defattr(644,root,root,755)
419 %doc contrib/sethostname.sh client/dhclient.conf.example
420 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
421 %attr(755,root,root) /sbin/dhclient
422 %attr(755,root,root) /sbin/dhclient-script
423 %{_mandir}/man5/dhclient.conf.5*
424 %{_mandir}/man5/dhclient.leases.5*
425 %{_mandir}/man8/dhclient.8*
426 %{_mandir}/man8/dhclient-script.8*
427 %dir %attr(750,root,root) /var/lib/dhclient
428 %ghost /var/lib/dhclient/dhclient.leases
429 %ghost /var/lib/dhclient/dhclient6.leases
432 %defattr(644,root,root,755)
433 %dir %{_sysconfdir}/dhclient-enter-hooks.d
434 %dir %{_sysconfdir}/dhclient-exit-hooks.d
437 %defattr(644,root,root,755)
438 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay
439 %attr(755,root,root) %{_sbindir}/dhcrelay
440 %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay
441 %{?with_systemd:%{systemdunitdir}/dhcp-relay.service}
442 %{_mandir}/man8/dhcrelay.8*
445 %defattr(644,root,root,755)
447 %{_libdir}/libdhcpctl.a
448 %{_libdir}/libomapi.a
449 %{_includedir}/dhcpctl
450 %{_includedir}/omapip
451 %{_mandir}/man3/dhcpctl.3*
452 %{_mandir}/man3/omapi.3*
455 %files -n openldap-schema-dhcp
456 %defattr(644,root,root,755)
457 %{schemadir}/dhcp.schema