net-lib.sh:parse_iscsi_root() fix target parsing
[dracut.git] / dracut.spec
blob08d64116d9d4d36a1af8f56d34a4ce607f4703ad
1 %define dracutlibdir %{_prefix}/lib/dracut
2 %bcond_without doc
4 # Variables must be defined
5 %define with_nbd 1
7 # nbd in Fedora only
8 %if 0%{?rhel} >= 6
9 %define with_nbd 0
10 %endif
12 Name: dracut
13 Version: xxx
14 Release: xxx
16 Summary: Initramfs generator using udev
17 %if 0%{?fedora} || 0%{?rhel}
18 Group: System Environment/Base
19 %endif
20 %if 0%{?suse_version}
21 Group: System/Base
22 %endif
24 # The entire source code is GPLv2+
25 # except install/* which is LGPLv2+
26 License: GPLv2+ and LGPLv2+
28 URL: https://dracut.wiki.kernel.org/
30 # Source can be generated by
31 # http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
32 Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
33 Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
36 BuildRequires: bash git
38 %if 0%{?fedora} || 0%{?rhel}
39 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
40 BuildRequires: pkgconfig
41 %endif
42 %if 0%{?fedora}
43 BuildRequires: bash-completion
44 BuildRequires: pkgconfig
45 %endif
47 %if 0%{?suse_version}
48 BuildRoot: %{_tmppath}/%{name}-%{version}-build
49 %endif
51 %if %{with doc}
52 %if 0%{?fedora} || 0%{?rhel}
53 BuildRequires: docbook-style-xsl docbook-dtds libxslt
54 %endif
56 %if 0%{?suse_version}
57 -BuildRequires: docbook-xsl-stylesheets libxslt
58 %endif
60 BuildRequires: asciidoc
61 %endif
64 %if 0%{?fedora} > 12 || 0%{?rhel}
65 # no "provides", because dracut does not offer
66 # all functionality of the obsoleted packages
67 Obsoletes: mkinitrd <= 6.0.93
68 Obsoletes: mkinitrd-devel <= 6.0.93
69 Obsoletes: nash <= 6.0.93
70 Obsoletes: libbdevid-python <= 6.0.93
71 %endif
73 %if 0%{?fedora} > 16 || 0%{?rhel} > 6
74 BuildRequires: systemd-units
75 %endif
77 %if 0%{?suse_version} > 9999
78 Obsoletes: mkinitrd < 2.6.1
79 Provides: mkinitrd = 2.6.1
80 %endif
82 Obsoletes: dracut-kernel < 005
83 Provides: dracut-kernel = %{version}-%{release}
85 Obsoletes: dracut <= 029
86 Obsoletes: dracut-norescue
87 Provides: dracut-norescue
89 Requires: bash >= 4
90 Requires: coreutils
91 Requires: cpio
92 Requires: filesystem >= 2.1.0
93 Requires: findutils
94 Requires: grep
95 Requires: hardlink
96 Requires: gzip xz
97 Requires: kmod
98 Requires: sed
99 Requires: kpartx
101 %if 0%{?fedora} || 0%{?rhel} > 6
102 Requires: util-linux >= 2.21
103 Requires: systemd >= 199
104 Requires: procps-ng
105 Conflicts: grubby < 8.23
106 Conflicts: initscripts < 8.63-1
107 Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
108 Conflicts: bcache-tools < 0-0.14.20130909git
109 %else
110 Requires: udev > 166
111 Requires: util-linux-ng >= 2.21
112 %endif
114 Conflicts: mdadm < 3.2.6-14
116 %description
117 dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
118 Unlike existing implementations, dracut does hard-code as little as possible
119 into the initramfs. dracut contains various modules which are driven by the
120 event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
121 NFS, iSCSI, NBD, FCoE with the dracut-network package.
123 %package network
124 Summary: dracut modules to build a dracut initramfs with network support
125 Requires: %{name} = %{version}-%{release}
126 Requires: iputils
127 Requires: iproute
128 Requires: dhclient
129 Obsoletes: dracut-generic < 008
130 Provides: dracut-generic = %{version}-%{release}
132 %description network
133 This package requires everything which is needed to build a generic
134 all purpose initramfs with network support with dracut.
136 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
137 %package fips
138 Summary: dracut modules to build a dracut initramfs with an integrity check
139 Requires: %{name} = %{version}-%{release}
140 Requires: hmaccalc
141 %if 0%{?rhel} > 5
142 # For Alpha 3, we want nss instead of nss-softokn
143 Requires: nss
144 %else
145 Requires: nss-softokn
146 %endif
147 Requires: nss-softokn-freebl
149 %description fips
150 This package requires everything which is needed to build an
151 initramfs with dracut, which does an integrity check.
152 %endif
154 %package fips-aesni
155 Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
156 Requires: %{name}-fips = %{version}-%{release}
158 %description fips-aesni
159 This package requires everything which is needed to build an
160 initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
162 %package caps
163 Summary: dracut modules to build a dracut initramfs which drops capabilities
164 Requires: %{name} = %{version}-%{release}
165 Requires: libcap
167 %description caps
168 This package requires everything which is needed to build an
169 initramfs with dracut, which drops capabilities.
171 %package config-generic
172 Summary: dracut configuration to turn off hostonly image generation
173 Requires: %{name} = %{version}-%{release}
174 Obsoletes: dracut-nohostonly
175 Provides: dracut-nohostonly
177 %description config-generic
178 This package provides the configuration to turn off the host specific initramfs
179 generation with dracut and generates a generic image by default.
181 %package config-rescue
182 Summary: dracut configuration to turn on rescue image generation
183 Requires: %{name} = %{version}-%{release}
184 Obsoletes: dracut <= 029
186 %description config-rescue
187 This package provides the configuration to turn on the rescue initramfs
188 generation with dracut.
190 %package tools
191 Summary: dracut tools to build the local initramfs
192 Requires: %{name} = %{version}-%{release}
194 %description tools
195 This package contains tools to assemble the local initrd and host configuration.
197 %prep
198 %setup -q -n %{name}-%{version}
199 cp %{SOURCE1} .
201 %if %{defined PATCH1}
202 git init
203 git config user.email "dracut-maint@redhat.com"
204 git config user.name "Fedora dracut team"
205 git add .
206 git commit -a -q -m "%{version} baseline."
208 # Apply all the patches.
209 git am -p1 %{patches}
210 %endif
212 %build
213 %configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
214 %if %{without doc}
215 --disable-documentation
216 %endif
218 make %{?_smp_mflags}
220 %install
221 %if 0%{?fedora} || 0%{?rhel}
222 rm -rf -- $RPM_BUILD_ROOT
223 %endif
224 make %{?_smp_mflags} install \
225 DESTDIR=$RPM_BUILD_ROOT \
226 libdir=%{_prefix}/lib
228 echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
230 %if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
231 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
232 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
233 %endif
235 %if %{defined _unitdir}
236 # for systemd, better use systemd-bootchart
237 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
238 %endif
240 # we do not support dash in the initramfs
241 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
243 # remove gentoo specific modules
244 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
246 %if %{defined _unitdir}
247 # with systemd IMA and selinux modules do not make sense
248 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
249 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
250 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
251 %endif
253 mkdir -p $RPM_BUILD_ROOT/boot/dracut
254 mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
255 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
256 touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
257 mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
259 %if 0%{?fedora} || 0%{?rhel}
260 install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
261 rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
262 %endif
263 %if 0%{?suse_version}
264 install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
265 %endif
267 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
268 install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
269 %endif
271 %if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
272 rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
273 rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
274 %endif
276 %if 0%{?fedora} || 0%{?rhel} > 6
277 # FIXME: remove after F19
278 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
279 install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
281 echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
282 echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
283 %endif
285 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
286 > $RPM_BUILD_ROOT/etc/system-fips
287 %endif
289 # create compat symlink
290 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
291 ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
293 %clean
294 rm -rf -- $RPM_BUILD_ROOT
296 %files
297 %defattr(-,root,root,0755)
298 %if %{with doc}
299 %doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
300 %endif
301 %{!?_licensedir:%global license %%doc}
302 %license COPYING lgpl-2.1.txt
303 %{_bindir}/dracut
304 # compat symlink
305 %{_sbindir}/dracut
306 %{_datadir}/bash-completion/completions/dracut
307 %{_datadir}/bash-completion/completions/lsinitrd
308 %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
309 %{_bindir}/mkinitrd
310 %{_bindir}/lsinitrd
311 %endif
312 %dir %{dracutlibdir}
313 %dir %{dracutlibdir}/modules.d
314 %{dracutlibdir}/dracut-functions.sh
315 %{dracutlibdir}/dracut-functions
316 %{dracutlibdir}/dracut-version.sh
317 %{dracutlibdir}/dracut-logger.sh
318 %{dracutlibdir}/dracut-initramfs-restore
319 %{dracutlibdir}/dracut-install
320 %{dracutlibdir}/skipcpio
321 %config(noreplace) %{_sysconfdir}/dracut.conf
322 %if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
323 %{dracutlibdir}/dracut.conf.d/01-dist.conf
324 %endif
325 %dir %{_sysconfdir}/dracut.conf.d
326 %dir %{dracutlibdir}/dracut.conf.d
328 %if %{with doc}
329 %{_mandir}/man8/dracut.8*
330 %{_mandir}/man8/*service.8*
331 %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
332 %{_mandir}/man8/mkinitrd.8*
333 %{_mandir}/man1/lsinitrd.1*
334 %endif
335 %{_mandir}/man7/dracut.kernel.7*
336 %{_mandir}/man7/dracut.cmdline.7*
337 %{_mandir}/man7/dracut.modules.7*
338 %{_mandir}/man7/dracut.bootup.7*
339 %{_mandir}/man5/dracut.conf.5*
340 %endif
342 %if %{defined _unitdir}
343 %{dracutlibdir}/modules.d/00systemd-bootchart
344 %else
345 %{dracutlibdir}/modules.d/00bootchart
346 %endif
347 %{dracutlibdir}/modules.d/00bash
348 %{dracutlibdir}/modules.d/03modsign
349 %{dracutlibdir}/modules.d/03rescue
350 %{dracutlibdir}/modules.d/04watchdog
351 %{dracutlibdir}/modules.d/05busybox
352 %{dracutlibdir}/modules.d/10i18n
353 %{dracutlibdir}/modules.d/30convertfs
354 %{dracutlibdir}/modules.d/45url-lib
355 %{dracutlibdir}/modules.d/50drm
356 %{dracutlibdir}/modules.d/50plymouth
357 %{dracutlibdir}/modules.d/80cms
358 %{dracutlibdir}/modules.d/90btrfs
359 %{dracutlibdir}/modules.d/90crypt
360 %{dracutlibdir}/modules.d/90dm
361 %{dracutlibdir}/modules.d/90dmraid
362 %{dracutlibdir}/modules.d/90dmsquash-live
363 %{dracutlibdir}/modules.d/90kernel-modules
364 %{dracutlibdir}/modules.d/90lvm
365 %{dracutlibdir}/modules.d/90mdraid
366 %{dracutlibdir}/modules.d/90multipath
367 %{dracutlibdir}/modules.d/90qemu
368 %{dracutlibdir}/modules.d/91crypt-gpg
369 %{dracutlibdir}/modules.d/91crypt-loop
370 %{dracutlibdir}/modules.d/95debug
371 %{dracutlibdir}/modules.d/95resume
372 %{dracutlibdir}/modules.d/95rootfs-block
373 %{dracutlibdir}/modules.d/95dasd
374 %{dracutlibdir}/modules.d/95dasd_mod
375 %{dracutlibdir}/modules.d/95dasd_rules
376 %{dracutlibdir}/modules.d/95fstab-sys
377 %{dracutlibdir}/modules.d/95zfcp
378 %{dracutlibdir}/modules.d/95zfcp_rules
379 %{dracutlibdir}/modules.d/95terminfo
380 %{dracutlibdir}/modules.d/95udev-rules
381 %{dracutlibdir}/modules.d/95virtfs
382 %if %{undefined _unitdir}
383 %{dracutlibdir}/modules.d/96securityfs
384 %{dracutlibdir}/modules.d/97masterkey
385 %{dracutlibdir}/modules.d/98integrity
386 %endif
387 %{dracutlibdir}/modules.d/97biosdevname
388 %{dracutlibdir}/modules.d/98ecryptfs
389 %{dracutlibdir}/modules.d/98pollcdrom
390 %{dracutlibdir}/modules.d/98selinux
391 %{dracutlibdir}/modules.d/98syslog
392 %{dracutlibdir}/modules.d/98systemd
393 %{dracutlibdir}/modules.d/98usrmount
394 %{dracutlibdir}/modules.d/99base
395 %{dracutlibdir}/modules.d/99fs-lib
396 %{dracutlibdir}/modules.d/99img-lib
397 %{dracutlibdir}/modules.d/99shutdown
398 %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
399 %dir %{_sharedstatedir}/initramfs
400 %if %{defined _unitdir}
401 %{_unitdir}/dracut-shutdown.service
402 %{_unitdir}/sysinit.target.wants/dracut-shutdown.service
403 %{_unitdir}/dracut-cmdline.service
404 %{_unitdir}/dracut-initqueue.service
405 %{_unitdir}/dracut-mount.service
406 %{_unitdir}/dracut-pre-mount.service
407 %{_unitdir}/dracut-pre-pivot.service
408 %{_unitdir}/dracut-pre-trigger.service
409 %{_unitdir}/dracut-pre-udev.service
410 %{_unitdir}/initrd.target.wants/dracut-cmdline.service
411 %{_unitdir}/initrd.target.wants/dracut-initqueue.service
412 %{_unitdir}/initrd.target.wants/dracut-mount.service
413 %{_unitdir}/initrd.target.wants/dracut-pre-mount.service
414 %{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
415 %{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
416 %{_unitdir}/initrd.target.wants/dracut-pre-udev.service
418 %endif
419 %if 0%{?fedora} || 0%{?rhel} > 6
420 %{_prefix}/lib/kernel/install.d/50-dracut.install
421 %endif
423 %files network
424 %defattr(-,root,root,0755)
425 %{dracutlibdir}/modules.d/40network
426 %{dracutlibdir}/modules.d/95fcoe
427 %{dracutlibdir}/modules.d/95iscsi
428 %{dracutlibdir}/modules.d/90livenet
429 %{dracutlibdir}/modules.d/90qemu-net
430 %{dracutlibdir}/modules.d/95cifs
431 %{dracutlibdir}/modules.d/95nbd
432 %{dracutlibdir}/modules.d/95nfs
433 %{dracutlibdir}/modules.d/95ssh-client
434 %{dracutlibdir}/modules.d/45ifcfg
435 %{dracutlibdir}/modules.d/95znet
436 %{dracutlibdir}/modules.d/95fcoe-uefi
437 %{dracutlibdir}/modules.d/99uefi-lib
439 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
440 %files fips
441 %defattr(-,root,root,0755)
442 %{dracutlibdir}/modules.d/01fips
443 %{dracutlibdir}/dracut.conf.d/40-fips.conf
444 %config(missingok) /etc/system-fips
445 %endif
447 %files fips-aesni
448 %defattr(-,root,root,0755)
449 %{dracutlibdir}/modules.d/02fips-aesni
451 %files caps
452 %defattr(-,root,root,0755)
453 %{dracutlibdir}/modules.d/02caps
455 %files tools
456 %defattr(-,root,root,0755)
458 %if %{with doc}
459 %doc %{_mandir}/man8/dracut-catimages.8*
460 %endif
462 %{_bindir}/dracut-catimages
463 %dir /boot/dracut
464 %dir /var/lib/dracut
465 %dir /var/lib/dracut/overlay
467 %files config-generic
468 %defattr(-,root,root,0755)
469 %{dracutlibdir}/dracut.conf.d/02-generic-image.conf
471 %files config-rescue
472 %defattr(-,root,root,0755)
473 %{dracutlibdir}/dracut.conf.d/02-rescue.conf
474 %if 0%{?fedora} || 0%{?rhel} > 6
475 %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
476 %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
477 %endif
479 %changelog