[PATCH 4/6] dist-kernel-utils.eclass: check if symlink exists before updating
Nowa Ammerlaan <[email protected]> Fri, 12 Jun 2026 20:58:02 +0200
| Newsgroups | gmane.linux.gentoo.devel |
|---|---|
| Message-ID | <[email protected]> |
When quickpkg is used the pkg_preinst phase may be run twice. Therefore we should check first if the incorrect symlink is still present before attempting to update it for the merged-usr layout. Closes: https://bugs.gentoo.org/977187 Signed-off-by: Nowa Ammerlaan <[email protected]> --- eclass/dist-kernel-utils.eclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 78cdd1fa2de7..c41b1aa494cd 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -425,10 +425,13 @@ dist-kernel_update_lib_symlinks() { if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then # Adjust symlinks for merged-usr. - rm "${ED}/lib/modules/${version}"/{build,source} || die - dosym "../../../src/linux-${version}" "/usr/lib/modules/${version}/build" - dosym "../../../src/linux-${version}" "/usr/lib/modules/${version}/source" local file + for file in build source; do + if [[ -L "${ED}/lib/modules/${version}/${file}" ]]; then + rm "${ED}/lib/modules/${version}/${file}" || die + dosym "../../../src/linux-${version}" "/usr/lib/modules/${version}/${file}" + fi + done for file in .config System.map; do if [[ -L "${ED}/lib/modules/${version}/${file#.}" ]]; then rm "${ED}/lib/modules/${version}/${file#.}" || die -- 2.54.0