grml / grml-debootstrap

wrapper around debootstrap
59 stars 27 forks source link

INITRD_GENERATOR=dracut yet initramfs-tools is installed during the build process #235

Closed adrelanos closed 9 months ago

adrelanos commented 10 months ago

Even with environment variable INITRD_GENERATOR=dracut, first initramfs-tools is being installed. Later during grml-debootstrap's run, dracut is being installed

The previous installation of initramfs-tools is unnecessary, takes time and might even cause issues in case there are any bugs.

This happens during the function kernel because of installation of packages linux-image-amd64 linux-headers-amd64 busybox firmware-linux-free. This is because linux-image-amd64 depends on linux-image-6.1.0-13-amd64 which then depends on linux-initramfs-tool and the default is initramfs-tools.

To fix this, the kernel function could be modified.

currently:

       DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES dracut

suggested:

     if [ "$INITRD_GENERATOR" = 'dracut' ] ; then
       # install dracut here already to avoid needlessly pulling initramfs-tools
       # shellcheck disable=SC2086
       DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES dracut
     else
       DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES
     fi

I will test this and send a PR if possible.