summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Nichols <nichoj@gentoo.org>2006-06-28 14:25:48 +0000
committerJoshua Nichols <nichoj@gentoo.org>2006-06-28 14:25:48 +0000
commit37ab8204875ce0c023886251a36e840ec57bf857 (patch)
tree660ec34ae450d846da53a63908411d2ed48fb9ae
parentUndoing unintentional changes (diff)
downloadjava-config-37ab8204875ce0c023886251a36e840ec57bf857.tar.gz
java-config-37ab8204875ce0c023886251a36e840ec57bf857.tar.bz2
java-config-37ab8204875ce0c023886251a36e840ec57bf857.zip
Updates and tweaks to run-java-tool.
svn path=/java-config-ng/branches/axxo/; revision=2393
-rw-r--r--src/run-java-tool28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/run-java-tool b/src/run-java-tool
index c2aa04b..600ae51 100644
--- a/src/run-java-tool
+++ b/src/run-java-tool
@@ -1,27 +1,39 @@
#!/bin/bash
+user_vm="${HOME}/.gentoo/java-config-2/current-user-vm"
+system_vm="/etc/java-config-2/current-system-vm"
+# Try GENTOO_VM
if [[ -n ${GENTOO_VM} ]]; then
- vmpath=/usr/lib/jvm/${GENTOO_VM}/
-elif [[ -h ${HOME}/.gentoo/java-config-2/current-user-vm ]]; then
- vmpath=${HOME}/.gentoo/java-config-2/current-user-vm/
+ vmpath="/usr/lib/jvm/${GENTOO_VM}/"
+# Then user VM
+elif [[ -h ${user_vm} ]]; then
+ vmpath=$(readlink ${user_vm})
+# And fall back to the system VM
else
- vmpath=/etc/java-config-2/current-system-vm/
+ 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} "${@}"
else
if [[ ! -d ${vmpath} ]]; then
- echo "Could not find: ${vmpath}" >&2
- echo "Wrong system/user vm or GENTOO_VM" >&2
+ echo "Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2
+ if [[ -n ${GENTOO_VM} ]]; then
+ echo "Invalid value for GENTOO_VM: ${GENTOO_VM}"
+ elif [[ -h ${user_vm} ]]; then
+ echo "Invalid User VM: ${vm_handle}" >&2
+ else
+ echo "Invalid System VM: ${vm_handle}" >&2
+ fi
else
- echo "Want too run ${vmpath}/{,jre}/bin/${tool} but it does not exist or is not executable" >&2
- echo "Broken vm install" >&2
+ echo "Tried to execute ${bin} and ${jrebin}, but neither exist." >&2
+ echo "Perhaps there is something wrong with the install of ${vm_handle}?" >&2
fi
exit 1
fi