1 |
%define _catdir /var/cache/man |
2 |
|
3 |
%define major_version 4.4.3 |
4 |
%define patch_version P1 |
5 |
|
6 |
Name: dhcp |
7 |
Epoch: 3 |
8 |
#Version: %{major_version} |
9 |
Version: %{major_version}%{patch_version} |
10 |
Release: %mkrel 2 |
11 |
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server/relay agent/client |
12 |
License: Distributable |
13 |
Group: System/Servers |
14 |
URL: https://www.isc.org/dhcp/ |
15 |
#Source0: ftp://ftp.isc.org/isc/%{name}/%{major_version}/%{name}-%{major_version}.tar.gz |
16 |
#Source1: ftp://ftp.isc.org/isc/%{name}/%{major_version}/%{name}-%{major_version}.tar.gz.sha512.asc |
17 |
Source0: ftp://ftp.isc.org/isc/%{name}/%{major_version}-%{patch_version}/%{name}-%{major_version}-%{patch_version}.tar.gz |
18 |
Source1: ftp://ftp.isc.org/isc/%{name}/%{major_version}-%{patch_version}/%{name}-%{major_version}-%{patch_version}.tar.gz.sha512.asc |
19 |
Source2: dhcpd.conf |
20 |
Source3: dhcpd6.conf |
21 |
Source4: dhcp-dynamic-dns-examples.tar.bz2 |
22 |
Source7: dhcpreport.pl |
23 |
Source8: dhcpd-chroot.sh |
24 |
# (eugeni) dhclient-exit-hooks script |
25 |
Source9: dhclient-exit-hooks |
26 |
Source11: dhclient-hook-static-routes |
27 |
Source10: draft-ietf-dhc-ldap-schema-01.txt |
28 |
Source12: dhcpd.service |
29 |
Source14: dhcpd6.service |
30 |
Source16: dhcrelay.service |
31 |
Source17: dhcpd.tmpfiles |
32 |
Source18: dhclient.tmpfiles |
33 |
Source19: dhcrelay.tmpfiles |
34 |
# mageia patches |
35 |
Patch100: dhcp-4.2.2-ifup.patch |
36 |
Patch101: dhcp-4.3.4-fix-format-errors.patch |
37 |
Patch103: dhcp-4.2.5-P1-man.patch |
38 |
Patch104: dhcp-4.4.3-change-lft-when-ip-unchanged.patch |
39 |
# fedora patches |
40 |
Patch7: dhcp-4.2.0-default-requested-options.patch |
41 |
Patch15: dhcp-4.2.2-missing-ipv6-not-fatal.patch |
42 |
Patch17: dhcp-4.2.0-add_timeout_when_NULL.patch |
43 |
Patch18: dhcp-4.3.0-64_bit_lease_parse.patch |
44 |
|
45 |
# Change /var/run to /run to please systemd |
46 |
# 2019-05-15 (kekePower) |
47 |
Patch19: dhcp-4.4.1-var-run-to-run.patch |
48 |
|
49 |
Patch27: 0027-Add-missed-sd-notify-patch-to-manage-dhcpd-with-syst.patch |
50 |
|
51 |
BuildRequires: bind-devel |
52 |
BuildRequires: pkgconfig(krb5) |
53 |
BuildRequires: groff-for-man |
54 |
BuildRequires: openldap-devel |
55 |
BuildRequires: pkgconfig(libsystemd) |
56 |
Requires(preun): rpm-helper >= 0.24.8-1 |
57 |
|
58 |
%description |
59 |
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows |
60 |
individual devices on an IP network to get their own network configuration |
61 |
information (IP address, subnetmask, broadcast address, etc.) from a DHCP |
62 |
server. The overall purpose of DHCP is to make it easier to administer a |
63 |
large network. The dhcp package includes the DHCP server and a DHCP relay |
64 |
agent. You will also need to install the dhcp-client or dhcpcd package, |
65 |
or pump or dhcpxd, which provides the DHCP client daemon, on client machines. |
66 |
|
67 |
If you want the DHCP server and/or relay, you will also need to install the |
68 |
dhcp-server and/or dhcp-relay packages. |
69 |
|
70 |
%package common |
71 |
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server |
72 |
Group: System/Servers |
73 |
|
74 |
%description common |
75 |
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows |
76 |
individual devices on an IP network to get their own network |
77 |
configuration information (IP address, subnetmask, broadcast address, |
78 |
etc.) from a DHCP server. The overall purpose of DHCP is to make it |
79 |
easier to administer a large network. The dhcp package includes the |
80 |
DHCP server and a DHCP relay agent. |
81 |
|
82 |
You will also need to install the dhcp-client or dhcpcd package, or pump or |
83 |
dhcpxd, which provides the DHCP client daemon, on client machines. If you |
84 |
want the DHCP server and/or relay, you will also need to install the |
85 |
dhcp-server and/or dhcp-relay packages. |
86 |
|
87 |
%package doc |
88 |
Summary: Documentation about the ISC DHCP server/client |
89 |
Group: System/Servers |
90 |
|
91 |
%description doc |
92 |
This package contains RFC/API/protocol documentation about the ISC |
93 |
DHCP server and client. |
94 |
|
95 |
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows |
96 |
individual devices on an IP network to get their own network |
97 |
configuration information (IP address, subnetmask, broadcast address, |
98 |
etc.) from a DHCP server. The overall purpose of DHCP is to make it |
99 |
easier to administer a large network. The dhcp package includes the |
100 |
DHCP server and a DHCP relay agent. |
101 |
|
102 |
%package server |
103 |
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server |
104 |
Group: System/Servers |
105 |
Requires: dhcp-common = %{epoch}:%{version}-%{release} |
106 |
Requires(post): systemd >= %{systemd_required_version} |
107 |
Requires(post): rpm-helper >= 0.24.8-1 |
108 |
Requires(preun): rpm-helper >= 0.24.8-1 |
109 |
|
110 |
%description server |
111 |
DHCP server is the Internet Software Consortium (ISC) DHCP server for various |
112 |
UNIX operating systems. It allows a UNIX machine to serve DHCP requests from |
113 |
the network. |
114 |
|
115 |
You should install dhcp-server if you want to set up a DHCP server on your |
116 |
network. You will also need to install the base dhcp package. |
117 |
|
118 |
%package client |
119 |
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) client |
120 |
Group: System/Servers |
121 |
Requires: dhcp-common = %{epoch}:%{version}-%{release} |
122 |
Requires(post): systemd >= %{systemd_required_version} |
123 |
# dhclient-exit-hooks was in server package |
124 |
Conflicts: dhcp-server < 4.3.1-2 |
125 |
|
126 |
%description client |
127 |
DHCP client is the Internet Software Consortium (ISC) DHCP client for various |
128 |
UNIX operating systems. It allows a UNIX machine to obtain it's networking |
129 |
parameters from a DHCP server. |
130 |
|
131 |
You should install dhcp-client if you want to use the ISC DHCP client instead |
132 |
of the Red Hat DHCP client, pump, or dhcpcd, or dhcpxd. You will also need to |
133 |
install the base dhcp package. |
134 |
|
135 |
%package relay |
136 |
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) relay |
137 |
Group: System/Servers |
138 |
Requires: dhcp-common = %{epoch}:%{version}-%{release} |
139 |
Requires(post): systemd >= %{systemd_required_version} |
140 |
Requires(post): rpm-helper >= 0.24.8-1 |
141 |
Requires(preun): rpm-helper >= 0.24.8-1 |
142 |
|
143 |
%description relay |
144 |
DHCP relay is the Internet Software Consortium (ISC) relay agent for DHCP |
145 |
packets. It is used on a subnet with DHCP clients to "relay" their requests |
146 |
to a subnet that has a DHCP server on it. Because DHCP packets can be |
147 |
broadcast, they will not be routed off of the local subnet. The DHCP relay |
148 |
takes care of this for the client. |
149 |
|
150 |
%package devel |
151 |
Summary: Development headers and libraries for the dhcpctl API |
152 |
Group: Development/Other |
153 |
Requires: dhcp-common = %{epoch}:%{version}-%{release} |
154 |
|
155 |
%description devel |
156 |
DHCP devel contains all of the libraries and headers for developing with the |
157 |
Internet Software Consortium (ISC) dhcpctl API. |
158 |
|
159 |
%prep |
160 |
%setup -q -n %{name}-%{major_version}-%{patch_version} |
161 |
#%setup -q -n %{name}-%{major_version} |
162 |
%patch101 -p1 -b .format_not_a_string_literal_and_no_format_arguments |
163 |
%patch103 -p1 -b .man |
164 |
%patch104 -p1 -b .change_lft_when_ip_unchanged |
165 |
|
166 |
# Add NIS domain, NIS servers, NTP servers, interface-mtu and domain-search |
167 |
# to the list of default requested DHCP options |
168 |
%patch7 -p1 -b .requested |
169 |
# Handle cases in add_timeout() where the function is called with a NULL |
170 |
# value for the 'when' parameter |
171 |
%patch17 -p1 -b .dracut |
172 |
# Ensure 64-bit platforms parse lease file dates & times correctly |
173 |
%patch18 -p1 -b .64-bit_lease_parse |
174 |
|
175 |
%patch19 -p1 -b .var_run_to_run |
176 |
|
177 |
%patch27 -p1 |
178 |
|
179 |
install -m0644 %{SOURCE10} doc |
180 |
|
181 |
%build |
182 |
autoreconf -fi |
183 |
%serverbuild |
184 |
%configure --enable-paranoia --enable-early-chroot --enable-binary-leases \ |
185 |
--with-ldap --with-ldapcrypto --with-ldap-gssapi \ |
186 |
--with-srv-lease-file=%{_var}/lib/dhcpd/dhcpd.leases \ |
187 |
--with-srv6-lease-file=%{_var}/lib/dhcpd/dhcpd6.leases \ |
188 |
--with-cli-lease-file=%{_var}/lib/dhclient/dhclient.leases \ |
189 |
--with-cli6-lease-file=%{_var}/lib/dhclient/dhclient6.leases \ |
190 |
--with-srv-pid-file=/run/dhcpd/dhcpd.pid \ |
191 |
--with-srv6-pid-file=/run/dhcpd/dhcpd6.pid \ |
192 |
--with-cli-pid-file=/run/dhclient/dhclient.pid \ |
193 |
--with-cli6-pid-file=/run/dhclient/dhclient6.pid \ |
194 |
--with-relay-pid-file=/run/dhcrelay/dhcrelay.pid \ |
195 |
--with-systemd |
196 |
# Do not use make_build here as not parallelized |
197 |
make |
198 |
|
199 |
%install |
200 |
%make_install |
201 |
|
202 |
# Install correct dhclient-script |
203 |
install -d %{buildroot}/sbin |
204 |
mv %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient |
205 |
install -m 755 client/scripts/linux %{buildroot}/sbin/dhclient-script |
206 |
|
207 |
install -d %{buildroot}%{_unitdir} |
208 |
install -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/dhcpd.service |
209 |
install -m 644 %{SOURCE14} %{buildroot}%{_unitdir}/dhcpd6.service |
210 |
install -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/dhcrelay.service |
211 |
|
212 |
install -D -p -m 644 %{SOURCE17} %{buildroot}%{_tmpfilesdir}/dhcpd.conf |
213 |
install -D -p -m 644 %{SOURCE18} %{buildroot}%{_tmpfilesdir}/dhclient.conf |
214 |
install -D -p -m 644 %{SOURCE19} %{buildroot}%{_tmpfilesdir}/dhcrelay.conf |
215 |
|
216 |
install -m 755 %{SOURCE7} %{SOURCE8} %{buildroot}%{_sbindir} |
217 |
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir} |
218 |
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir} |
219 |
install -m 755 contrib/ldap/dhcpd-conf-to-ldap %{buildroot}%{_sbindir} |
220 |
|
221 |
# install exit-hooks script to /etc/ |
222 |
install -m 755 %{SOURCE9} %{buildroot}%{_sysconfdir} |
223 |
install -d %{buildroot}%{_sysconfdir}/dhclient-exit-hooks.d |
224 |
install -m 755 %{SOURCE11} %{buildroot}%{_sysconfdir}/dhclient-exit-hooks.d/static-routes.sh |
225 |
|
226 |
install -d %{buildroot}%{_sysconfdir}/sysconfig |
227 |
cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd <<EOF |
228 |
# You can set here various option for dhcpd |
229 |
|
230 |
# Which configuration file to use. |
231 |
# CONFIGFILE="/etc/dhcpd.conf" |
232 |
|
233 |
# Where to store the lease state information. |
234 |
# LEASEFILE="/var/lib/dhcpd/dhcpd.leases" |
235 |
|
236 |
# Define INTERFACES to limit which network interfaces dhcpd listens on. |
237 |
# The default null value causes dhcpd to listen on all interfaces. |
238 |
#INTERFACES="" |
239 |
|
240 |
# Define OPTIONS with any other options to pass to the dhcpd server. |
241 |
# See dhcpd(8) for available options and syntax. |
242 |
OPTIONS="-q" |
243 |
EOF |
244 |
|
245 |
cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd6 <<EOF |
246 |
# You can set here various option for dhcpd |
247 |
|
248 |
# Which configuration file to use. |
249 |
# CONFIGFILE="/etc/dhcpd6.conf" |
250 |
|
251 |
# Where to store the lease state information. |
252 |
# LEASEFILE="/var/lib/dhcpd/dhcpd6.leases" |
253 |
|
254 |
# Define INTERFACES to limit which network interfaces dhcpd listens on. |
255 |
# The default null value causes dhcpd to listen on all interfaces. |
256 |
#INTERFACES="" |
257 |
|
258 |
# Define OPTIONS with any other options to pass to the dhcpd server. |
259 |
# See dhcpd(8) for available options and syntax. |
260 |
OPTIONS="-q" |
261 |
EOF |
262 |
|
263 |
install -d %{buildroot}%{_var}/lib/dhcpd |
264 |
touch %{buildroot}%{_var}/lib/dhcpd/dhcpd.leases |
265 |
touch %{buildroot}%{_var}/lib/dhcpd/dhcpd6.leases |
266 |
install -d %{buildroot}%{_var}/lib/dhclient |
267 |
touch %{buildroot}%{_var}/lib/dhclient/dhclient.leases |
268 |
|
269 |
# Copy sample conf files into position (called by doc macro) |
270 |
cp -p doc/examples/dhclient-dhcpv6.conf client/dhclient6.conf.example |
271 |
cp -p doc/examples/dhcpd-dhcpv6.conf server/dhcpd6.conf.example |
272 |
|
273 |
cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay <<EOF |
274 |
# Define DHCRELAYARGS with any other options to pass to the dhcrelay server. |
275 |
# See dhcrelay(8) for available options and syntax. |
276 |
# Define at the end the servers with a list of one or more DHCP servers where |
277 |
# DHCP packets are to be relayed to and from. This is mandatory. Replace xxxx with them |
278 |
#DHCRELAYARGS="-q -iu eth0 -id eth1 192.168.1.1" |
279 |
DHCRELAYARGS="-q" |
280 |
EOF |
281 |
|
282 |
find . -type d -exec chmod 0755 {} \; |
283 |
find . -type f -exec chmod 0644 {} \; |
284 |
|
285 |
rm -rf doc/ja_JP.eucJP |
286 |
|
287 |
# remove empty files |
288 |
find -size 0 |grep ldap | xargs rm -rf |
289 |
|
290 |
# remove unwanted file |
291 |
rm -f %{buildroot}%{_sysconfdir}/dhclient.conf.example |
292 |
rm -f %{buildroot}%{_sysconfdir}/dhcpd.conf.example |
293 |
rm -f %{buildroot}%{_libdir}/*.a |
294 |
|
295 |
%pre server |
296 |
%_pre_useradd dhcpd /dev/null /bin/false |
297 |
|
298 |
%post server |
299 |
%_post_service dhcpd |
300 |
%_post_service dhcpd6 |
301 |
%_tmpfilescreate dhcpd |
302 |
# New dhcpd lease file |
303 |
if [ ! -f %{_var}/lib/dhcpd/dhcpd.leases ]; then |
304 |
touch %{_var}/lib/dhcpd/dhcpd.leases |
305 |
fi |
306 |
if [ ! -f %{_var}/lib/dhcpd/dhcpd6.leases ]; then |
307 |
touch %{_var}/lib/dhcpd/dhcpd6.leases |
308 |
fi |
309 |
|
310 |
%postun server |
311 |
%_postun_userdel dhcpd |
312 |
|
313 |
%post relay |
314 |
%_post_service dhcrelay |
315 |
%_tmpfilescreate dhcrelay |
316 |
|
317 |
%preun server |
318 |
%_preun_service dhcpd |
319 |
%_preun_service dhcpd6 |
320 |
|
321 |
%preun relay |
322 |
%_preun_service dhcrelay |
323 |
|
324 |
%post client |
325 |
touch %{_var}/lib/dhclient/dhclient.leases |
326 |
%_tmpfilescreate dhclient |
327 |
|
328 |
%postun client |
329 |
rm -rf %{_var}/lib/dhclient/dhclient.leases |
330 |
|
331 |
%files common |
332 |
%doc README contrib/ldap/README.ldap RELNOTES |
333 |
%doc contrib/3.0b1-lease-convert |
334 |
%{_mandir}/man5/dhcp-options.5* |
335 |
|
336 |
%files doc |
337 |
%doc doc/* |
338 |
|
339 |
%files server |
340 |
%doc server/dhcpd*.conf.example tests/failover contrib/ldap/dhcp.schema |
341 |
%{_unitdir}/dhcpd.service |
342 |
%{_unitdir}/dhcpd6.service |
343 |
%{_tmpfilesdir}/dhcpd.conf |
344 |
%config(noreplace) %{_sysconfdir}/dhcpd.conf |
345 |
%config(noreplace) %{_sysconfdir}/dhcpd6.conf |
346 |
%config(noreplace) %{_sysconfdir}/sysconfig/dhcpd |
347 |
%config(noreplace) %{_sysconfdir}/sysconfig/dhcpd6 |
348 |
%{_sbindir}/dhcpd |
349 |
%{_sbindir}/dhcpreport.pl |
350 |
%{_sbindir}/dhcpd-conf-to-ldap |
351 |
%{_sbindir}/dhcpd-chroot.sh |
352 |
%{_bindir}/omshell |
353 |
%{_mandir}/man1/omshell.1* |
354 |
%{_mandir}/man3/omapi.3* |
355 |
%{_mandir}/man5/dhcpd.conf.5* |
356 |
%{_mandir}/man5/dhcpd.leases.5* |
357 |
%{_mandir}/man5/dhcp-eval.5* |
358 |
%{_mandir}/man8/dhcpd.8* |
359 |
%dir %{_var}/lib/dhcpd |
360 |
%config(noreplace) %ghost %{_var}/lib/dhcpd/dhcpd.leases |
361 |
%config(noreplace) %ghost %{_var}/lib/dhcpd/dhcpd6.leases |
362 |
|
363 |
%files relay |
364 |
%{_unitdir}/dhcrelay.service |
365 |
%{_tmpfilesdir}/dhcrelay.conf |
366 |
%config(noreplace) %{_sysconfdir}/sysconfig/dhcrelay |
367 |
%{_sbindir}/dhcrelay |
368 |
%{_mandir}/man8/dhcrelay.8* |
369 |
|
370 |
%files client |
371 |
%doc client/dhclient*.conf.example |
372 |
%{_sysconfdir}/dhclient-exit-hooks |
373 |
%{_sysconfdir}/dhclient-exit-hooks.d |
374 |
%attr (0755,root,root) /sbin/dhclient-script |
375 |
%{_tmpfilesdir}/dhclient.conf |
376 |
/sbin/dhclient |
377 |
%{_mandir}/man5/dhclient.conf.5* |
378 |
%{_mandir}/man5/dhclient.leases.5* |
379 |
%{_mandir}/man8/dhclient.8* |
380 |
%{_mandir}/man8/dhclient-script.8* |
381 |
%dir %{_var}/lib/dhclient |
382 |
%config(noreplace) %ghost %{_var}/lib/dhclient/dhclient.leases |
383 |
|
384 |
%files devel |
385 |
%{_includedir}/* |
386 |
%{_mandir}/man3/* |