Summary: | kernel-install.eclass: kernel-install_pkg_postrm: find: No such file or directory | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Fab <netbox253> |
Component: | Eclasses | Assignee: | Distribution Kernel Project <dist-kernel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | netbox253, nowa |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
kernel unmerge
remove empty directory if it exists remove empty directory only if it exists |
Description
Fab
2025-01-02 13:55:40 UTC
Created attachment 915741 [details]
kernel unmerge
Created attachment 915864 [details] remove empty directory if it exists This patch is fixing the issue for me : > Would you like to unmerge these packages? [Yes/No] yes > >>> Waiting 5 seconds before starting... > >>> (Control-C to abort)... > >>> Unmerging in: 5 4 3 2 1 > >>> Unmerging (1 of 1) sys-kernel/gentoo-kernel-bin-5.15.175... > * Removing initramfs ... [ ok ] > > * GNU info directory index is up-to-date. Created attachment 915894 [details, diff]
remove empty directory only if it exists
Second version of the patch to properly consider the rmdir return value.
(In reply to Fab from comment #3) > Created attachment 915894 [details, diff] [details, diff] > remove empty directory only if it exists > > Second version of the patch to properly consider the rmdir return value. This fix modifies the intended behaviour. The find strips empty directories only, whereas after this patch the whole kernel source tree would be removed which is not what we want. I propose this fix instead, could you let me know if it resolves the problem on your end? 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 Yes, this works fine. Thank you. The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65594d38630d5406918d60ebd6d2aba7367aad6b commit 65594d38630d5406918d60ebd6d2aba7367aad6b Author: Nowa Ammerlaan <nowa@gentoo.org> AuthorDate: 2025-01-06 09:20:31 +0000 Commit: Nowa Ammerlaan <nowa@gentoo.org> CommitDate: 2025-01-06 14:37:49 +0000 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@gentoo.org> eclass/kernel-install.eclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) |