Since we remove /usr/src/linux-KV_FULL but by design keep the /lib/modules/KV_FULL, we end up with some dead symlinks after depcleaning a dist-kernel. This has the unfortunate side effect of tricking systemd's kernel-install into thinking that a kernel image for this kernel still exists. Which leads to some ugliness further down the line. We can easily resolve the problem by cleaning up these dead symlinks.
Signed-off-by: Nowa Ammerlaan <n...@gentoo.org> --- eclass/kernel-install.eclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index cf34007844a8..67143278f368 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -808,6 +808,9 @@ kernel-install_pkg_postrm() { find "${kernel_dir}" -depth -type d -empty -delete eend ${?} fi + + # Clean up dead symlinks + find -L "${EROOT}/lib/modules/${KV_FULL}" -type l -delete } # @FUNCTION: kernel-install_pkg_config -- 2.48.1