commit:     904b2a23c2aacdab32af335d9875aec391ee0268
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 25 18:01:50 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jan 25 18:29:17 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=904b2a23

kernel-install.eclass: Remove initramfs in postrm

Closes: https://bugs.gentoo.org/706332
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/kernel-install.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 7e64f44c8c3..1fdeb1bf4dc 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -302,7 +302,13 @@ kernel-install_pkg_prerm() {
 kernel-install_pkg_postrm() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       # (no-op at the moment)
+       if [[ -z ${ROOT} ]] && use initramfs; then
+               local image_path=$(kernel-install_get_image_path)
+               ebegin "Removing initramfs"
+               rm -f "${EROOT}/usr/src/linux-${PV}/${image_path%/*}/initrd" &&
+                       find "${EROOT}/usr/src/linux-${PV}" -depth -type d 
-empty -delete
+               eend ${?}
+       fi
 }
 
 _KERNEL_INSTALL_ECLASS=1

Reply via email to