aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2013-02-13 21:07:40 +0000
committerRalph Sennhauser <sera@gentoo.org>2013-02-13 21:07:40 +0000
commite34976ee88fe4af11ac893a5d14d433b8fb0ff4d (patch)
treec9d37fea27c350c0e1871226b586228309acd292 /src/scripts/run-java-tool.bash.in
parentAdd missing bug reference to NEWS (diff)
downloadeselect-java-e34976ee88fe4af11ac893a5d14d433b8fb0ff4d.tar.gz
eselect-java-e34976ee88fe4af11ac893a5d14d433b8fb0ff4d.tar.bz2
eselect-java-e34976ee88fe4af11ac893a5d14d433b8fb0ff4d.zip
Prefixify run-java-tool
svn path=/projects/eselect-java/trunk/; revision=9207
Diffstat (limited to 'src/scripts/run-java-tool.bash.in')
-rw-r--r--src/scripts/run-java-tool.bash.in50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/scripts/run-java-tool.bash.in b/src/scripts/run-java-tool.bash.in
new file mode 100644
index 0000000..d6b41d4
--- /dev/null
+++ b/src/scripts/run-java-tool.bash.in
@@ -0,0 +1,50 @@
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+
+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}/"
+# Then user VM
+elif [[ -h ${user_vm} ]]; then
+ vmpath=$(readlink ${user_vm})
+# And fall back to the system VM
+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} "${@}"
+else
+ if [[ ! -d ${vmpath} ]]; then
+ 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
+ if [[ ${tool} = "run-java-tool.bash" ]]; then
+ echo "* run-java-tool was invoked directly" >&2
+ echo "* run-java-tool should only be used via symlinks to it" >&2
+ else
+ echo "* ${tool} is not available for ${vm_handle} on $(uname -m)" >&2
+ echo "* IMPORTANT: some Java tools are not available on some VMs on some architectures" >&2
+ if (( ${EUID} != 0 )) && [[ "${DISPLAY}" ]] && type -p notify-send > /dev/null; then
+ notify-send -i java-icon48 "Gentoo Java Launcher" "<b>${tool}</b> is not available for ${vm_handle}
+<a href=\"http://www.gentoo.org/doc/en/java.xml\">Gentoo Java User Guide</a>"
+ fi
+ fi
+ fi
+ exit 1
+fi
+
+