]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp.spec
e534e60e8b6f8060d38858ea2f4806cfcea2a083
[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 %bcond_without  systemd         # without systemd units
6
7 %define         ver     4.4.2
8 %if 0
9 %define         pverdot .P1
10 %define         pverdir -P1
11 %else
12 %define         pverdot %{nil}
13 %define         pverdir %{nil}
14 %endif
15
16 # vendor string
17 %define vvendor PLD/Linux
18 Summary:        DHCP Server
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)
22 Name:           dhcp
23 Version:        %{ver}%{pverdot}
24 Release:        2
25 Epoch:          4
26 License:        MIT
27 Group:          Networking/Daemons
28 Source0:        ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
29 # Source0-md5:  2afdaf8498dc1edaf3012efdd589b3e1
30 Source1:        %{name}.init
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
57 BuildRequires:  groff
58 %ifarch %{arm}
59 BuildRequires:  libatomic-devel
60 %endif
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}
70 Provides:       dhcpd
71 Obsoletes:      dhcpv6-server
72 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
73
74 %define         _sbindir        /sbin
75 %define         schemadir       /usr/share/openldap/schema
76
77 %description
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.
83
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
89 también las atiende.
90
91 %description -l pl.UTF-8
92 Serwer DHCP (Dynamic Host Configuration Protocol).
93
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
97 dużymi sieciami IP.
98
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
105 software BETA.
106
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
113 BuildArch:      noarch
114
115 %description -n openldap-schema-dhcp
116 This package contains LDAPv3 schema for use with the DHCP Server.
117
118 %description -n openldap-schema-dhcp -l pl.UTF-8
119 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
120
121 %package client
122 Summary:        DHCP Client
123 Summary(pl.UTF-8):      Klient DHCP
124 Group:          Networking/Daemons
125 Requires:       coreutils
126 Requires:       iproute2
127 Requires:       net-tools
128 Suggests:       avahi-autoipd
129 Provides:       dhclient = %{epoch}:%{version}-%{release}
130 Obsoletes:      dhclient
131 Obsoletes:      dhcpv6-client
132 Obsoletes:      libdhcp4client
133 Obsoletes:      libdhcp4client-devel
134 Obsoletes:      libdhcp4client-static
135
136 %description client
137 Dynamic Host Configuration Protocol Client.
138
139 %description client -l pl.UTF-8
140 Klient DHCP (Dynamic Host Configuration Protocol).
141
142 %package client-dirs
143 Summary:        DHCP Client common dirs
144 Summary(pl.UTF-8):      Katalogi klienta DHCP
145 Group:          Networking/Daemons
146
147 %description client-dirs
148 Directories for scripts for dhcp-client.
149
150 %description client-dirs -l pl.UTF-8
151 Katalog przeznaczony na skrypty dla klienta dhcp.
152
153 %package relay
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
161
162 %description 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
167 this for the client.
168
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
173 podsieci.
174
175 %package devel
176 Summary:        DHCP development includes and libs
177 Summary(pl.UTF-8):      Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
178 Group:          Development/Libraries
179
180 %description devel
181 Includes OMAPI and dhcptl libraries.
182
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.
186
187 The dhcpctl set of functions provide an API that can be used to
188 communicate with and manipulate a running ISC DHCP server.
189
190 %description devel -l pl.UTF-8
191 Zawiera biblioteki OMAPI oraz dhcpctl.
192
193 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
194 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
195
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.
198
199 %prep
200 %setup -q -n %{name}-%{ver}%{pverdir}
201 %patch0 -p1
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?
209 #%%patch1 -p1
210 %patch2 -p1
211 %patch3 -p1
212 %patch4 -p1
213 %patch5 -p1
214 %patch6 -p1
215 %patch7 -p1
216 %patch8 -p1
217 %patch9 -p1
218 %patch10 -p1
219 %patch11 -p1
220
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
225
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
229
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
236 done
237
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
243 done
244
245 %build
246 %{__libtoolize}
247 %{__aclocal}
248 %{__autoconf}
249 %{__autoheader}
250 %{__automake}
251 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
252 %configure \
253 %ifarch %{arm}
254         LIBS="-latomic" \
255 %endif
256         %{!?with_static_libs:--disable-static} \
257         --enable-dhcpv6 \
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
265 %{__make} -j1
266
267 %install
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}}
270
271 %{__make} install \
272         DESTDIR=$RPM_BUILD_ROOT
273
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
279
280 %if %{with systemd}
281 install -d $RPM_BUILD_ROOT%{systemdunitdir}
282 cp -p %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{systemdunitdir}
283 %endif
284
285 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
286
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
289
290 %if %{with ldap}
291 install -d $RPM_BUILD_ROOT%{schemadir}
292 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
293 %endif
294
295 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
296
297 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
298 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
299
300 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
301 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
302
303 %if %{with static_libs}
304 # HACK: strip doesn't like .a inside .a
305 install -d stripworkdir
306 cd stripworkdir
307 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
308         archives=$(ar t $a | grep '\.a$' || :)
309         [ "$archives" ] || continue
310
311         # hope we don't have to recurse here
312         for ar in $archives; do
313                 rm -f *.o *.a
314                 ar x $a $ar
315                 ar x $ar
316                 ar d $a $ar
317                 ar cr $a *.o
318         done
319 done
320 cd -
321 %endif
322
323 %clean
324 rm -rf $RPM_BUILD_ROOT
325
326 %post
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}
334
335 %preun
336 if [ "$1" = "0" ];then
337         %service dhcpd stop
338         /sbin/chkconfig --del dhcpd
339         %service dhcpd6 stop
340         /sbin/chkconfig --del dhcpd6
341 fi
342 %{?with_systemd:%systemd_preun dhcpd.service dhcpd6.service}
343
344 %postun
345 %{?with_systemd:%systemd_reload}
346
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
350 fi
351 %systemd_trigger dhcpd.service dhcpd6.service
352
353 %post -n openldap-schema-dhcp
354 %openldap_schema_register %{schemadir}/dhcp.schema -d core
355 %service -q ldap restart
356
357 %postun -n openldap-schema-dhcp
358 if [ "$1" = "0" ]; then
359         %openldap_schema_unregister %{schemadir}/dhcp.schema
360         %service -q ldap restart
361 fi
362
363 %post relay
364 /sbin/chkconfig --add dhcp-relay
365 if [ -f /var/lock/subsys/dhcrelay ]; then
366         mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
367 fi
368 %service dhcp-relay restart "dhcrelay daemon"
369 %{?with_systemd:%systemd_post dhcp-relay.service}
370
371 %preun relay
372 if [ "$1" = "0" ];then
373         %service dhcp-relay stop
374         /sbin/chkconfig --del dhcp-relay
375 fi
376 %{?with_systemd:%systemd_preun dhcp-relay.service}
377
378 %postun relay
379 %{?with_systemd:%systemd_reload}
380
381 %triggerpostun -- dhcp-relay < 4.4.2-2
382 %systemd_trigger dhcp-relay.service
383
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/
387 fi
388 if [ -f /etc/dhclient-exit-hooks ] ; then
389         mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
390 fi
391
392 %files
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
403 %if %{with systemd}
404 %{systemdunitdir}/dhcpd.service
405 %{systemdunitdir}/dhcpd6.service
406 %endif
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*
416
417 %files client
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
430
431 %files client-dirs
432 %defattr(644,root,root,755)
433 %dir %{_sysconfdir}/dhclient-enter-hooks.d
434 %dir %{_sysconfdir}/dhclient-exit-hooks.d
435
436 %files relay
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*
443
444 %files devel
445 %defattr(644,root,root,755)
446 %{_libdir}/libdhcp.a
447 %{_libdir}/libdhcpctl.a
448 %{_libdir}/libomapi.a
449 %{_includedir}/dhcpctl
450 %{_includedir}/omapip
451 %{_mandir}/man3/dhcpctl.3*
452 %{_mandir}/man3/omapi.3*
453
454 %if %{with ldap}
455 %files -n openldap-schema-dhcp
456 %defattr(644,root,root,755)
457 %{schemadir}/dhcp.schema
458 %endif
This page took 0.094461 seconds and 2 git commands to generate.