commit:     65594d38630d5406918d60ebd6d2aba7367aad6b
Author:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  6 09:20:31 2025 +0000
Commit:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
CommitDate: Mon Jan  6 14:37:49 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65594d38

kernel-install.eclass: only remove initrd,uki.efi if src dir still exists

Closes: https://bugs.gentoo.org/947359
Signed-off-by: Nowa Ammerlaan <nowa <AT> gentoo.org>

 eclass/kernel-install.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 6ca39e551110..f70556ad41f5 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -738,9 +738,9 @@ kernel-install_pkg_postinst() {
 kernel-install_pkg_postrm() {
        debug-print-function ${FUNCNAME} "$@"
 
-       if [[ ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then
-               local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL}
-               local image_path=$(dist-kernel_get_image_path)
+       local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL}
+       local image_path=$(dist-kernel_get_image_path)
+       if [[ ! ${KERNEL_IUSE_GENERIC_UKI} && -d ${kernel_dir} ]]; then
                ebegin "Removing initramfs"
                rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} &&
                        find "${kernel_dir}" -depth -type d -empty -delete

Reply via email to