# # spec file for package dracut # # Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define dracutlibdir %{_prefix}/lib/dracut %if 0%{?suse_version} >= 1550 %define dracut_sbindir %{_sbindir} %else %define dracut_sbindir /sbin %endif Name: dracut Version: 059+suse.598.g824fcff4 Release: 0 Summary: Event driven initramfs infrastructure License: GPLv2+ and LGPLv2+ and GPLv2 Group: System/Base URL: https://github.com/dracutdevs/dracut/wiki Source0: dracut-%{version}.tar.xz Source1: dracut-rpmlintrc Source2: README.susemaint BuildRequires: asciidoc BuildRequires: bash BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt BuildRequires: pkgconfig(libkmod) BuildRequires: pkgconfig(systemd) >= 219 BuildRequires: cargo BuildRequires: rust Requires: gawk Requires: %{_bindir}/get_kernel_version Requires: bash Requires: coreutils Requires(post): coreutils Requires: cpio Requires: elfutils Requires: file Requires: filesystem Requires: findutils Requires: grep Requires: hardlink Requires: modutils Requires: pigz Requires: sed Requires: systemd >= 219 Recommends: (tpm2.0-tools if tpm2-0-tss) Requires: udev > 166 Requires: util-linux >= 2.21 Requires: util-linux-systemd >= 2.36.2 Recommends: xz Requires: zstd # We use 'btrfs fi usage' that was not present before Conflicts: btrfsprogs < 3.18 # suse-module-tools >= 15.4.7 is prepared for the removal of mkinitrd-suse.sh Conflicts: suse-module-tools < 15.4.7 %{?systemd_requires} %description Dracut contains tools to create a bootable initramfs for Linux kernels >= 2.6. Dracut contains various modules which are driven by the event-based udev and systemd. Having root on MD, DM, LVM2, LUKS is supported as well as NFS, iSCSI, NBD, FCoE. %ifnarch %ix86 %package fips Summary: Dracut modules to build a dracut initramfs with an integrity check Group: System/Base Requires: %{name} = %{version}-%{release} Requires: libkcapi-tools %description fips This package requires everything which is needed to build an initramfs with dracut, which does an integrity check of the kernel and its cryptography during startup. %endif %ifnarch %ix86 %package ima Summary: Dracut modules to build a dracut initramfs with IMA Group: System/Base Requires: %{name} = %{version}-%{release} Requires: evmctl Requires: keyutils %description ima This package requires everything which is needed to build an initramfs (using dracut) which tries to load an IMA policy during startup. %endif %package tools Summary: Tools to build a local initramfs Group: System/Base Requires: %{name} # split-provides for upgrade from SLES12 SP1 to SLES12 SP2 Provides: %{name}:%{_bindir}/dracut-catimages %description tools This package contains tools to assemble the local initrd and host configuration. %package extra Summary: Dracut modules usually not required for normal operation Group: System/Base Requires: %{name} = %{version}-%{release} %description extra This package contains all modules that are part of dracut upstream but are not normally supported or required. %prep %autosetup %build %configure \ --systemdsystemunitdir=%{_unitdir} \ --bashcompletiondir=%{_datadir}/bash-completion/completions \ --libdir=%{_prefix}/lib \ --enable-dracut-cpio %make_build all CFLAGS="%{optflags}" %{?_smp_mflags} %install %make_install echo -e "#!/bin/bash\nDRACUT_VERSION=%{version}-%{release}" > %{buildroot}%{dracutlibdir}/dracut-version.sh # remove architecture specific modules %ifnarch ppc ppc64 ppc64le ppc64p7 rm -rf %{buildroot}%{dracutlibdir}/modules.d/90ppcmac %endif %ifnarch s390 s390x rm -rf %{buildroot}%{dracutlibdir}/modules.d/80cms rm -rf %{buildroot}%{dracutlibdir}/modules.d/81cio_ignore rm -rf %{buildroot}%{dracutlibdir}/modules.d/91zipl rm -rf %{buildroot}%{dracutlibdir}/modules.d/95dasd rm -rf %{buildroot}%{dracutlibdir}/modules.d/95dasd_mod rm -rf %{buildroot}%{dracutlibdir}/modules.d/95dcssblk rm -rf %{buildroot}%{dracutlibdir}/modules.d/95zfcp rm -rf %{buildroot}%{dracutlibdir}/modules.d/95znet %else rm -rf %{buildroot}%{dracutlibdir}/modules.d/00warpclock %endif mkdir -p %{buildroot}/boot/dracut mkdir -p %{buildroot}%{_localstatedir}/lib/dracut/overlay mkdir -p %{buildroot}%{_localstatedir}/log touch %{buildroot}%{_localstatedir}/log/dracut.log install -D -m 0644 dracut.conf.d/suse.conf.example %{buildroot}%{dracutlibdir}/dracut.conf.d/01-dist.conf install -m 0644 suse/99-debug.conf %{buildroot}%{_sysconfdir}/dracut.conf.d/99-debug.conf %ifnarch %ix86 install -m 0644 dracut.conf.d/fips.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-fips.conf install -m 0644 dracut.conf.d/ima.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-ima.conf %endif # bsc#915218 %ifarch s390 s390x install -m 0644 suse/s390x_persistent_policy.conf %{buildroot}%{_sysconfdir}/dracut.conf.d/10-persistent_policy.conf %else install -m 0644 suse/persistent_policy.conf %{buildroot}%{_sysconfdir}/dracut.conf.d/10-persistent_policy.conf %endif %if 0%{?suse_version} rm -f %{buildroot}%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-suse.sh %{buildroot}%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh %else mv %{buildroot}%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh %{buildroot}%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh %{buildroot}%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh %endif # create a link to dracut-util to be able to parse kernel command line arguments at generation time ln -s %{dracutlibdir}/dracut-util %{buildroot}%{dracutlibdir}/dracut-getarg %post # check whether /var/run has been converted to a symlink if [ ! -L /var/run ]; then grep -q '^[ ]*GRUB_CMDLINE_LINUX_DEFAULT=.*rd.convertfs' /etc/default/grub || \ sed -i '/^[ ]*GRUB_CMDLINE_LINUX_DEFAULT.*/s/"$/ rd.convertfs"/' /etc/default/grub || : if ! grep --no-message 'add_dracutmodules+=" convertfs "' /etc/dracut.conf.d/05-convertfs.conf; then cat >>/etc/dracut.conf.d/05-convertfs.conf<