diff options
author | 2015-12-30 16:15:16 +0000 | |
---|---|---|
committer | 2015-12-31 23:55:56 +0000 | |
commit | 2b7d0f087f3fdec791a4667512ecfe71f64a9ffd (patch) | |
tree | 490c0be2faa561faa25acf9a102bcf4d26924771 | |
parent | Make run-java-tool.bash POSIX-compliant (diff) | |
download | eselect-java-2b7d0f087f3fdec791a4667512ecfe71f64a9ffd.tar.gz eselect-java-2b7d0f087f3fdec791a4667512ecfe71f64a9ffd.tar.bz2 eselect-java-2b7d0f087f3fdec791a4667512ecfe71f64a9ffd.zip |
Utilise the VM's PATH variable in run-java-tool
Continue to fall back to bin and jre/bin just in case.
-rw-r--r-- | src/scripts/run-java-tool.bash.in | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/scripts/run-java-tool.bash.in b/src/scripts/run-java-tool.bash.in index 49db910..6bccac0 100644 --- a/src/scripts/run-java-tool.bash.in +++ b/src/scripts/run-java-tool.bash.in @@ -2,9 +2,10 @@ user_vm="${HOME}/.gentoo@GENTOO_PORTAGE_EPREFIX@/java-config-2/current-user-vm" system_vm="@GENTOO_PORTAGE_EPREFIX@/etc/java-config-2/current-system-vm" + # Try GENTOO_VM if [ -n "${GENTOO_VM}" ]; then - vmpath="@GENTOO_PORTAGE_EPREFIX@/usr/lib/jvm/${GENTOO_VM}/" + vmpath="@GENTOO_PORTAGE_EPREFIX@/usr/lib/jvm/${GENTOO_VM}" # Then user VM elif [ -h "${user_vm}" ]; then vmpath=$(readlink "${user_vm}") @@ -12,15 +13,19 @@ elif [ -h "${user_vm}" ]; then else vmpath=$(readlink "${system_vm}") fi -tool=$(basename "$0") -bin=${vmpath}/bin/${tool} -jrebin=${vmpath}/jre/bin/${tool} -vm_handle=$(basename "${vmpath}") -if [ -x "${bin}" ]; then - exec "${bin}" "${@}" -elif [ -x "${jrebin}" ]; then - exec "${jrebin}" "${@}" +vm_handle=${vmpath##*/} +tool=${0##*/} + +toolpath=$( + export PATH= + . "@GENTOO_PORTAGE_EPREFIX@/usr/share/java-config-2/vm/${vm_handle}" 2> /dev/null + : ${PATH:=${vmpath}/bin:${vmpath}/jre/bin} + "@GENTOO_PORTAGE_EPREFIX@/usr/bin/which" "${tool}" 2> /dev/null +) + +if [ -x "${toolpath}" ]; then + exec "${toolpath}" "${@}" else if [ ! -d "${vmpath}" ]; then echo "* Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2 |