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