From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 487F11384B4 for ; Fri, 1 Jan 2016 00:03:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E90C21C038; Fri, 1 Jan 2016 00:03:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5BD6421C029 for ; Fri, 1 Jan 2016 00:03:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56EBC3408EE for ; Fri, 1 Jan 2016 00:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2451CCF6 for ; Fri, 1 Jan 2016 00:03:39 +0000 (UTC) From: "James Le Cuirot" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "James Le Cuirot" Message-ID: <1451606156.2b7d0f087f3fdec791a4667512ecfe71f64a9ffd.chewi@gentoo> Subject: [gentoo-commits] proj/eselect-java:master commit in: src/scripts/ X-VCS-Repository: proj/eselect-java X-VCS-Files: src/scripts/run-java-tool.bash.in X-VCS-Directories: src/scripts/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: 2b7d0f087f3fdec791a4667512ecfe71f64a9ffd X-VCS-Branch: master Date: Fri, 1 Jan 2016 00:03:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4d1018f0-f4eb-426a-afb2-975e2618008e X-Archives-Hash: 2d99443e34cef8899bf6879df5ea8d50 commit: 2b7d0f087f3fdec791a4667512ecfe71f64a9ffd Author: James Le Cuirot gentoo org> AuthorDate: Wed Dec 30 16:15:16 2015 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Thu Dec 31 23:55:56 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=2b7d0f08 Utilise the VM's PATH variable in run-java-tool Continue to fall back to bin and jre/bin just in case. src/scripts/run-java-tool.bash.in | 23 ++++++++++++++--------- 1 file 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