]> git.ipfire.org Git - thirdparty/dracut.git/blob - dracut.spec
dracut_mkdir(): create parent directories as needed.
[thirdparty/dracut.git] / dracut.spec
1 %define dracutlibdir %{_prefix}/lib/dracut
2 %bcond_without doc
3
4 # We ship a .pc file but don't want to have a dep on pkg-config. We
5 # strip the automatically generated dep here and instead co-own the
6 # directory.
7 %global __requires_exclude pkg-config
8 %define dist_free_release xxx
9
10 Name: dracut
11 Version: xxx
12 Release: %{dist_free_release}%{?dist}
13
14 Summary: Initramfs generator using udev
15 %if 0%{?fedora} || 0%{?rhel}
16 Group: System Environment/Base
17 %endif
18 %if 0%{?suse_version}
19 Group: System/Base
20 %endif
21
22 # The entire source code is GPLv2+
23 # except install/* which is LGPLv2+
24 License: GPLv2+ and LGPLv2+
25
26 URL: https://dracut.wiki.kernel.org/
27
28 # Source can be generated by
29 # http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%%{version};sf=tgz
30 Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
31 Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
32
33 BuildRequires: bash
34 BuildRequires: git
35 BuildRequires: pkgconfig(libkmod) >= 23
36 BuildRequires: gcc
37
38 %if 0%{?fedora} || 0%{?rhel}
39 BuildRequires: pkgconfig
40 BuildRequires: systemd
41 %endif
42 %if 0%{?fedora}
43 BuildRequires: bash-completion
44 %endif
45
46 %if %{with doc}
47 %if 0%{?fedora} || 0%{?rhel}
48 BuildRequires: docbook-style-xsl docbook-dtds libxslt
49 %endif
50
51 %if 0%{?suse_version}
52 BuildRequires: docbook-xsl-stylesheets libxslt
53 %endif
54
55 BuildRequires: asciidoc
56 %endif
57
58 %if 0%{?suse_version} > 9999
59 Obsoletes: mkinitrd < 2.6.1
60 Provides: mkinitrd = 2.6.1
61 %endif
62
63 Obsoletes: dracut-fips <= 047
64 Provides: dracut-fips = %{version}-%{release}
65 Obsoletes: dracut-fips-aesni <= 047
66 Provides: dracut-fips-aesni = %{version}-%{release}
67
68 Requires: bash >= 4
69 Requires: coreutils
70 Requires: cpio
71 Requires: filesystem >= 2.1.0
72 Requires: findutils
73 Requires: grep
74 Requires: kmod
75 Requires: sed
76 Requires: xz
77 Requires: gzip
78
79 %if 0%{?fedora} || 0%{?rhel}
80 Recommends: hardlink
81 Recommends: pigz
82 Recommends: kpartx
83 Requires: util-linux >= 2.21
84 Requires: systemd >= 219
85 Requires: systemd-udev >= 219
86 Requires: procps-ng
87 %else
88 Requires: hardlink
89 Requires: gzip
90 Requires: kpartx
91 Requires: udev > 166
92 Requires: util-linux-ng >= 2.21
93 %endif
94
95 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
96 Requires: libkcapi-hmaccalc
97 %endif
98
99 %description
100 dracut contains tools to create bootable initramfses for the Linux
101 kernel. Unlike previous implementations, dracut hard-codes as little
102 as possible into the initramfs. dracut contains various modules which
103 are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS
104 is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network
105 package.
106
107 %package network
108 Summary: dracut modules to build a dracut initramfs with network support
109 %if 0%{?_module_build}
110 # In the module-build-service, we have pieces of dracut provided by different
111 # modules ("base-runtime" provides most functionality, but we need
112 # dracut-network in "installer". Since these two modules build with separate
113 # dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
114 Requires: %{name} >= %{version}-%{dist_free_release}
115 %else
116 Requires: %{name} = %{version}-%{release}
117 %endif
118 Requires: iputils
119 Requires: iproute
120 Requires: (NetworkManager >= 1.20 or dhclient)
121 Suggests: NetworkManager
122 Obsoletes: dracut-generic < 008
123 Provides: dracut-generic = %{version}-%{release}
124
125 %description network
126 This package requires everything which is needed to build a generic
127 all purpose initramfs with network support with dracut.
128
129 %package caps
130 Summary: dracut modules to build a dracut initramfs which drops capabilities
131 Requires: %{name} = %{version}-%{release}
132 Requires: libcap
133
134 %description caps
135 This package requires everything which is needed to build an
136 initramfs with dracut, which drops capabilities.
137
138 %package live
139 Summary: dracut modules to build a dracut initramfs with live image capabilities
140 %if 0%{?_module_build}
141 # See the network subpackage comment.
142 Requires: %{name} >= %{version}-%{dist_free_release}
143 %else
144 Requires: %{name} = %{version}-%{release}
145 %endif
146 Requires: %{name}-network = %{version}-%{release}
147 Requires: tar gzip coreutils bash device-mapper curl
148 %if 0%{?fedora}
149 Requires: fuse ntfs-3g
150 %endif
151
152 %description live
153 This package requires everything which is needed to build an
154 initramfs with dracut, with live image capabilities, like Live CDs.
155
156 %package config-generic
157 Summary: dracut configuration to turn off hostonly image generation
158 Requires: %{name} = %{version}-%{release}
159 Obsoletes: dracut-nohostonly < 030
160 Provides: dracut-nohostonly = %{version}-%{release}
161
162 %description config-generic
163 This package provides the configuration to turn off the host specific initramfs
164 generation with dracut and generates a generic image by default.
165
166 %package config-rescue
167 Summary: dracut configuration to turn on rescue image generation
168 Requires: %{name} = %{version}-%{release}
169 Obsoletes: dracut < 030
170
171 %description config-rescue
172 This package provides the configuration to turn on the rescue initramfs
173 generation with dracut.
174
175 %package tools
176 Summary: dracut tools to build the local initramfs
177 Requires: %{name} = %{version}-%{release}
178
179 %description tools
180 This package contains tools to assemble the local initrd and host configuration.
181
182 %package squash
183 Summary: dracut module to build an initramfs with most files in a squashfs image
184 Requires: %{name} = %{version}-%{release}
185 Requires: squashfs-tools
186
187 %description squash
188 This package provides a dracut module to build an initramfs, but store most files
189 in a squashfs image, result in a smaller initramfs size and reduce runtime memory
190 usage.
191
192 %prep
193 %autosetup -n %{name}-%{version} -S git_am
194 cp %{SOURCE1} .
195
196 %build
197 %configure --systemdsystemunitdir=%{_unitdir} \
198 --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \
199 --libdir=%{_prefix}/lib \
200 %if %{without doc}
201 --disable-documentation \
202 %endif
203 ${NULL}
204
205 make %{?_smp_mflags}
206
207 %install
208 make %{?_smp_mflags} install \
209 DESTDIR=$RPM_BUILD_ROOT \
210 libdir=%{_prefix}/lib
211
212 echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
213
214 %if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
215 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
216 %endif
217
218 %if %{defined _unitdir}
219 # for systemd, better use systemd-bootchart
220 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
221 %endif
222
223 # we do not support dash in the initramfs
224 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
225
226 # we do not support mksh in the initramfs
227 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00mksh
228
229 # remove gentoo specific modules
230 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
231
232 %if %{defined _unitdir}
233 # with systemd IMA and selinux modules do not make sense
234 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
235 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
236 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
237 %endif
238
239 %ifnarch s390 s390x
240 # remove architecture specific modules
241 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/80cms
242 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/81cio_ignore
243 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/91zipl
244 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd
245 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod
246 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules
247 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk
248 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
249 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
250 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
251 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
252 %else
253 rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
254 %endif
255
256 mkdir -p $RPM_BUILD_ROOT/boot/dracut
257 mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
258 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
259 touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
260 mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
261
262 %if 0%{?fedora} || 0%{?rhel}
263 install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
264 %endif
265 %if 0%{?suse_version}
266 install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
267 %else
268 rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
269 %endif
270
271 %if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
272 rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
273 rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
274 rm -f -- $RPM_BUILD_ROOT%{_mandir}/man8/mkinitrd.8*
275 rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
276 %endif
277
278 echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
279 echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
280
281 %if 0%{?fedora} || 0%{?rhel}
282 # FIXME: remove after F30
283 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
284 install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
285 %endif
286
287 %files
288 %if %{with doc}
289 %doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
290 %endif
291 %{!?_licensedir:%global license %%doc}
292 %license COPYING lgpl-2.1.txt
293 %{_bindir}/dracut
294 %{_datadir}/bash-completion/completions/dracut
295 %{_datadir}/bash-completion/completions/lsinitrd
296 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
297 %{_bindir}/mkinitrd
298 %{_bindir}/lsinitrd
299 %endif
300 %dir %{dracutlibdir}
301 %dir %{dracutlibdir}/modules.d
302 %{dracutlibdir}/dracut-functions.sh
303 %{dracutlibdir}/dracut-init.sh
304 %{dracutlibdir}/dracut-functions
305 %{dracutlibdir}/dracut-version.sh
306 %{dracutlibdir}/dracut-logger.sh
307 %{dracutlibdir}/dracut-initramfs-restore
308 %{dracutlibdir}/dracut-install
309 %{dracutlibdir}/skipcpio
310 %config(noreplace) %{_sysconfdir}/dracut.conf
311 %if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
312 %{dracutlibdir}/dracut.conf.d/01-dist.conf
313 %endif
314 %dir %{_sysconfdir}/dracut.conf.d
315 %dir %{dracutlibdir}/dracut.conf.d
316 %dir %{_datadir}/pkgconfig
317 %{_datadir}/pkgconfig/dracut.pc
318
319 %if %{with doc}
320 %{_mandir}/man8/dracut.8*
321 %{_mandir}/man8/*service.8*
322 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
323 %{_mandir}/man8/mkinitrd.8*
324 %{_mandir}/man1/lsinitrd.1*
325 %endif
326 %if 0%{?suse_version}
327 %{_mandir}/man8/mkinitrd-suse.8*
328 %endif
329 %{_mandir}/man7/dracut.kernel.7*
330 %{_mandir}/man7/dracut.cmdline.7*
331 %{_mandir}/man7/dracut.modules.7*
332 %{_mandir}/man7/dracut.bootup.7*
333 %{_mandir}/man5/dracut.conf.5*
334 %endif
335
336 %if %{undefined _unitdir}
337 %{dracutlibdir}/modules.d/00bootchart
338 %endif
339 %{dracutlibdir}/modules.d/00bash
340 %{dracutlibdir}/modules.d/00systemd
341 %ifnarch s390 s390x
342 %{dracutlibdir}/modules.d/00warpclock
343 %endif
344 %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
345 %{dracutlibdir}/modules.d/01fips
346 %endif
347 %{dracutlibdir}/modules.d/01systemd-initrd
348 %{dracutlibdir}/modules.d/03modsign
349 %{dracutlibdir}/modules.d/03rescue
350 %{dracutlibdir}/modules.d/04watchdog
351 %{dracutlibdir}/modules.d/05busybox
352 %{dracutlibdir}/modules.d/06rngd
353 %{dracutlibdir}/modules.d/10i18n
354 %{dracutlibdir}/modules.d/30convertfs
355 %{dracutlibdir}/modules.d/45url-lib
356 %{dracutlibdir}/modules.d/50drm
357 %{dracutlibdir}/modules.d/50plymouth
358 %{dracutlibdir}/modules.d/80lvmmerge
359 %{dracutlibdir}/modules.d/90btrfs
360 %{dracutlibdir}/modules.d/90crypt
361 %{dracutlibdir}/modules.d/90dm
362 %{dracutlibdir}/modules.d/90dmraid
363 %{dracutlibdir}/modules.d/90kernel-modules
364 %{dracutlibdir}/modules.d/90kernel-modules-extra
365 %{dracutlibdir}/modules.d/90lvm
366 %{dracutlibdir}/modules.d/90mdraid
367 %{dracutlibdir}/modules.d/90multipath
368 %{dracutlibdir}/modules.d/90stratis
369 %{dracutlibdir}/modules.d/90ppcmac
370 %{dracutlibdir}/modules.d/90qemu
371 %{dracutlibdir}/modules.d/91crypt-gpg
372 %{dracutlibdir}/modules.d/91crypt-loop
373 %{dracutlibdir}/modules.d/95debug
374 %{dracutlibdir}/modules.d/95fstab-sys
375 %{dracutlibdir}/modules.d/95lunmask
376 %{dracutlibdir}/modules.d/95resume
377 %{dracutlibdir}/modules.d/95rootfs-block
378 %{dracutlibdir}/modules.d/95terminfo
379 %{dracutlibdir}/modules.d/95udev-rules
380 %{dracutlibdir}/modules.d/95virtfs
381 %ifarch s390 s390x
382 %{dracutlibdir}/modules.d/80cms
383 %{dracutlibdir}/modules.d/81cio_ignore
384 %{dracutlibdir}/modules.d/91zipl
385 %{dracutlibdir}/modules.d/95dasd
386 %{dracutlibdir}/modules.d/95dasd_mod
387 %{dracutlibdir}/modules.d/95dasd_rules
388 %{dracutlibdir}/modules.d/95dcssblk
389 %{dracutlibdir}/modules.d/95qeth_rules
390 %{dracutlibdir}/modules.d/95zfcp
391 %{dracutlibdir}/modules.d/95zfcp_rules
392 %endif
393 %if %{undefined _unitdir}
394 %{dracutlibdir}/modules.d/96securityfs
395 %{dracutlibdir}/modules.d/97masterkey
396 %{dracutlibdir}/modules.d/98integrity
397 %endif
398 %{dracutlibdir}/modules.d/97biosdevname
399 %{dracutlibdir}/modules.d/98dracut-systemd
400 %{dracutlibdir}/modules.d/98ecryptfs
401 %{dracutlibdir}/modules.d/98pollcdrom
402 %{dracutlibdir}/modules.d/98selinux
403 %{dracutlibdir}/modules.d/98syslog
404 %{dracutlibdir}/modules.d/98usrmount
405 %{dracutlibdir}/modules.d/99base
406 %{dracutlibdir}/modules.d/99fs-lib
407 %{dracutlibdir}/modules.d/99shutdown
408 %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
409 %dir %{_sharedstatedir}/initramfs
410 %if %{defined _unitdir}
411 %{_unitdir}/dracut-shutdown.service
412 %{_unitdir}/sysinit.target.wants/dracut-shutdown.service
413 %{_unitdir}/dracut-cmdline.service
414 %{_unitdir}/dracut-initqueue.service
415 %{_unitdir}/dracut-mount.service
416 %{_unitdir}/dracut-pre-mount.service
417 %{_unitdir}/dracut-pre-pivot.service
418 %{_unitdir}/dracut-pre-trigger.service
419 %{_unitdir}/dracut-pre-udev.service
420 %{_unitdir}/initrd.target.wants/dracut-cmdline.service
421 %{_unitdir}/initrd.target.wants/dracut-initqueue.service
422 %{_unitdir}/initrd.target.wants/dracut-mount.service
423 %{_unitdir}/initrd.target.wants/dracut-pre-mount.service
424 %{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
425 %{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
426 %{_unitdir}/initrd.target.wants/dracut-pre-udev.service
427 %endif
428 %{_prefix}/lib/kernel/install.d/50-dracut.install
429
430 %files network
431 %{dracutlibdir}/modules.d/02systemd-networkd
432 %{dracutlibdir}/modules.d/35network-manager
433 %{dracutlibdir}/modules.d/35network-legacy
434 %{dracutlibdir}/modules.d/40network
435 %{dracutlibdir}/modules.d/45ifcfg
436 %{dracutlibdir}/modules.d/90kernel-network-modules
437 %{dracutlibdir}/modules.d/90qemu-net
438 %{dracutlibdir}/modules.d/95cifs
439 %{dracutlibdir}/modules.d/95fcoe
440 %{dracutlibdir}/modules.d/95fcoe-uefi
441 %{dracutlibdir}/modules.d/95iscsi
442 %{dracutlibdir}/modules.d/95nbd
443 %{dracutlibdir}/modules.d/95nfs
444 %{dracutlibdir}/modules.d/95ssh-client
445 %ifarch s390 s390x
446 %{dracutlibdir}/modules.d/95znet
447 %endif
448 %{dracutlibdir}/modules.d/99uefi-lib
449
450 %files caps
451 %{dracutlibdir}/modules.d/02caps
452
453 %files live
454 %{dracutlibdir}/modules.d/99img-lib
455 %{dracutlibdir}/modules.d/90dmsquash-live
456 %{dracutlibdir}/modules.d/90dmsquash-live-ntfs
457 %{dracutlibdir}/modules.d/90livenet
458
459 %files tools
460 %if %{with doc}
461 %doc %{_mandir}/man8/dracut-catimages.8*
462 %endif
463
464 %{_bindir}/dracut-catimages
465 %dir /boot/dracut
466 %dir /var/lib/dracut
467 %dir /var/lib/dracut/overlay
468
469 %files squash
470 %{dracutlibdir}/modules.d/99squash
471
472 %files config-generic
473 %{dracutlibdir}/dracut.conf.d/02-generic-image.conf
474
475 %files config-rescue
476 %{dracutlibdir}/dracut.conf.d/02-rescue.conf
477 %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
478 %if 0%{?fedora} || 0%{?rhel}
479 # FIXME: remove after F30
480 %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
481 %endif
482
483 %changelog