commit:     0e67f002afa93cbea82e077931111acb1fddb3f4
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 19 18:26:28 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 11:28:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=0e67f002

java-vm.eselect: fix symlink target when ROOT is not /

Bug: https://bugs.gentoo.org/793965
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 src/modules/java-vm.eselect.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index 8fac2a1..8181b8c 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -1,12 +1,12 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage the Java system and user VM"
 MAINTAINER="[email protected]"
 VERSION="@VERSION@"
 
-VM_BASE="${EROOT}/usr/lib/jvm"
+VM_BASE="${EPREFIX}/usr/lib/jvm"
 VM_SYSTEM="${EROOT}/etc/java-config-2/current-system-vm"
 VM_USER="${HOME}/.gentoo${EPREFIX}/java-config-2/current-user-vm"
 VM_CONFIG="${EROOT}/usr/share/java-config-2/vm"
@@ -14,7 +14,7 @@ VM_CONFIG="${EROOT}/usr/share/java-config-2/vm"
 find_targets() {
        local TARGETS=() target
 
-       for target in "${VM_BASE}"/*; do
+       for target in "${ROOT}${VM_BASE}"/*; do
                [[ -L "${target}" ]] && TARGETS+=( ${target##*/} )
        done
 
@@ -181,7 +181,7 @@ set_symlink() {
        fi
        if [[ -z ${target} ]] ; then
                die -q "Target \"${1}\" doesn't appear to be valid!"
-       elif [[ -d ${VM_BASE}/${target} ]] ; then
+       elif [[ -L ${ROOT}${VM_BASE}/${target} || -d 
${ROOT}${VM_BASE}/${target} ]] ; then
                local sym_dir=${symlink%/*}
                mkdir -p "${sym_dir}" || die -q "Could not create ${sym_dir}"
                ln -snf "${VM_BASE}/${target}" "${symlink}"

Reply via email to