1 |
commit: 2b7d0f087f3fdec791a4667512ecfe71f64a9ffd |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 30 16:15:16 2015 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 31 23:55:56 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=2b7d0f08 |
7 |
|
8 |
Utilise the VM's PATH variable in run-java-tool |
9 |
|
10 |
Continue to fall back to bin and jre/bin just in case. |
11 |
|
12 |
src/scripts/run-java-tool.bash.in | 23 ++++++++++++++--------- |
13 |
1 file changed, 14 insertions(+), 9 deletions(-) |
14 |
|
15 |
diff --git a/src/scripts/run-java-tool.bash.in b/src/scripts/run-java-tool.bash.in |
16 |
index 49db910..6bccac0 100644 |
17 |
--- a/src/scripts/run-java-tool.bash.in |
18 |
+++ b/src/scripts/run-java-tool.bash.in |
19 |
@@ -2,9 +2,10 @@ |
20 |
|
21 |
user_vm="${HOME}/.gentoo@GENTOO_PORTAGE_EPREFIX@/java-config-2/current-user-vm" |
22 |
system_vm="@GENTOO_PORTAGE_EPREFIX@/etc/java-config-2/current-system-vm" |
23 |
+ |
24 |
# Try GENTOO_VM |
25 |
if [ -n "${GENTOO_VM}" ]; then |
26 |
- vmpath="@GENTOO_PORTAGE_EPREFIX@/usr/lib/jvm/${GENTOO_VM}/" |
27 |
+ vmpath="@GENTOO_PORTAGE_EPREFIX@/usr/lib/jvm/${GENTOO_VM}" |
28 |
# Then user VM |
29 |
elif [ -h "${user_vm}" ]; then |
30 |
vmpath=$(readlink "${user_vm}") |
31 |
@@ -12,15 +13,19 @@ elif [ -h "${user_vm}" ]; then |
32 |
else |
33 |
vmpath=$(readlink "${system_vm}") |
34 |
fi |
35 |
-tool=$(basename "$0") |
36 |
-bin=${vmpath}/bin/${tool} |
37 |
-jrebin=${vmpath}/jre/bin/${tool} |
38 |
|
39 |
-vm_handle=$(basename "${vmpath}") |
40 |
-if [ -x "${bin}" ]; then |
41 |
- exec "${bin}" "${@}" |
42 |
-elif [ -x "${jrebin}" ]; then |
43 |
- exec "${jrebin}" "${@}" |
44 |
+vm_handle=${vmpath##*/} |
45 |
+tool=${0##*/} |
46 |
+ |
47 |
+toolpath=$( |
48 |
+ export PATH= |
49 |
+ . "@GENTOO_PORTAGE_EPREFIX@/usr/share/java-config-2/vm/${vm_handle}" 2> /dev/null |
50 |
+ : ${PATH:=${vmpath}/bin:${vmpath}/jre/bin} |
51 |
+ "@GENTOO_PORTAGE_EPREFIX@/usr/bin/which" "${tool}" 2> /dev/null |
52 |
+) |
53 |
+ |
54 |
+if [ -x "${toolpath}" ]; then |
55 |
+ exec "${toolpath}" "${@}" |
56 |
else |
57 |
if [ ! -d "${vmpath}" ]; then |
58 |
echo "* Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2 |