commit:     dc9ea91c8271f43fb58ce142000dcd5c32822c42
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 16 20:51:00 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Tue Jun 20 18:57:37 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc9ea91c

dist-kernel-utils.eclass: skip initrd installation when using uki

Gets rid of a hack that prevents 50-dracut.install from regenerating the initrd
when calling kernel-install. Instead instruct kernel-install to simply not run
this plugin.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/31358
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 eclass/dist-kernel-utils.eclass | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index c6892c2f0127..cfb6f40ac6fa 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -106,10 +106,20 @@ dist-kernel_install_kernel() {
                # install the combined executable in place of kernel
                image=${initrd}.efi
                mv "${initrd}" "${image}" || die
-               # put an empty file in place of initrd.  installing a duplicate
-               # file would waste disk space, and removing it entirely provokes
-               # kernel-install to regenerate it via dracut.
-               > "${initrd}"
+               # We moved the generated initrd, prevent dracut from running 
again
+               # https://github.com/dracutdevs/dracut/pull/2405
+               shopt -s nullglob
+               local plugins=()
+               for file in "${EROOT}"/usr/lib/kernel/install.d/*.install; do
+                       if ! has "${file##*/}" 50-dracut.install 
51-dracut-rescue.install; then
+                                       plugins+=( "${file}" )
+                       fi
+               done
+               for file in "${EROOT}"/etc/kernel/install.d/*.install; do
+                       plugins+=( "${file}" )
+               done
+               shopt -u nullglob
+               export KERNEL_INSTALL_PLUGINS="${KERNEL_INSTALL_PLUGINS} 
${plugins[@]}"
        fi
 
        ebegin "Installing the kernel via installkernel"

Reply via email to