commit:     aa4f1706fe35d8e49c69f3cd1c1caf66f3a0714d
Author:     Bertrand Jacquin <bertrand <AT> jacquin <DOT> bzh>
AuthorDate: Tue Sep 24 21:42:00 2019 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Mon Jun  7 11:58:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa4f1706

eclass/kernel-2: respect USE=symlink

kernel-2 eclass postinst_sources() creates /usr/usr/linux symlink
regardless of USE=symlink. MAKELINK variable controls the creation
of /usr/src/linux, however MAKELINK is always set to 1 only if
/usr/src/linux does not currently exist with no consideration for
USE=symlink.

This change simplify the whole /usr/usr/linux symlink creation to
instead depend on K_SYMLINK which is set if USE=symlink.

This change also refuse to remove existing /usr/usr/linux if it
currently exist while not being a symlink

Note that this is broken since 906501be57c0 ("adding symlink use flag
support")

Bug: https://bugs.gentoo.org/695592
Signed-off-by: Bertrand Jacquin <bertrand <AT> jacquin.bzh>
Closes: https://bugs.gentoo.org/695592
Closes: https://github.com/gentoo/gentoo/pull/13031
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 eclass/kernel-2.eclass | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 2d721ffca87..4c25ff3aef8 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -945,8 +945,6 @@ preinst_headers() {
 # see inline comments
 
 postinst_sources() {
-       local MAKELINK=0
-
        # if we have USE=symlink, then force K_SYMLINK=1
        use symlink && K_SYMLINK=1
 
@@ -960,14 +958,10 @@ postinst_sources() {
 
        # if we are to forcably symlink, delete it if it already exists first.
        if [[ ${K_SYMLINK} -gt 0 ]]; then
-               [[ -h ${EROOT%/}/usr/src/linux ]] && { rm 
"${EROOT%/}"/usr/src/linux || die; }
-               MAKELINK=1
-       fi
-
-       # if the link doesnt exist, lets create it
-       [[ ! -h ${EROOT%/}/usr/src/linux ]] && MAKELINK=1
+               if [[ -e ${EROOT%/}/usr/src/linux && ! -L 
${EROOT%/}/usr/src/linux ]] ; then
+                       die "${EROOT%/}/usr/src/linux exist and is not a 
symlink"
+               fi
 
-       if [[ ${MAKELINK} == 1 ]]; then
                ln -sf linux-${KV_FULL} "${EROOT%/}"/usr/src/linux || die
        fi
 

Reply via email to