aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2013-01-19 11:40:29 +0000
committerRalph Sennhauser <sera@gentoo.org>2013-01-19 11:40:29 +0000
commitedd56183efbce0d0df0fcfd89828ac734549a111 (patch)
treef641ed797797c273cfdbb1164ef4cf996cbcae32
parentDrop useless use of local variable (diff)
downloadeselect-java-edd56183efbce0d0df0fcfd89828ac734549a111.tar.gz
eselect-java-edd56183efbce0d0df0fcfd89828ac734549a111.tar.bz2
eselect-java-edd56183efbce0d0df0fcfd89828ac734549a111.zip
Import run-java-tool and install location to pkglibexecdir instead of bindir
svn path=/projects/eselect-java/trunk/; revision=9152
-rw-r--r--Makefile.am58
-rw-r--r--configure.ac1
-rw-r--r--src/scripts/run-java-tool.bash50
3 files changed, 109 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 8e45141..c65c41c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,6 @@
+dist_pkglibexec_SCRIPTS= \
+ src/scripts/run-java-tool.bash
+
modulesdir=$(datadir)/eselect/modules/
modules_DATA = \
@@ -45,3 +48,58 @@ dist-hook:
else \
echo "Needs a svn checkout to generate a ChangeLog" ; \
fi
+
+#------------------------------------------------------------------------------
+# FIXME let eselect java-vm handle symlinks.
+tools = \
+ appletviewer \
+ apt \
+ ControlPanel \
+ extcheck \
+ HtmlConverter \
+ idlj \
+ jar \
+ jarsigner \
+ java \
+ javac \
+ javadoc \
+ javah \
+ javap \
+ javaws \
+ jconsole \
+ jcontrol \
+ jdb \
+ jhat \
+ jinfo \
+ jmap \
+ jps \
+ jrunscript \
+ jsadebugd \
+ jstack \
+ jstat \
+ jstatd \
+ jvisualvm \
+ keytool \
+ native2ascii \
+ orbd \
+ pack200 \
+ policytool \
+ rmic \
+ rmid \
+ rmiregistry \
+ schemagen \
+ serialver \
+ servertool \
+ tnameserv \
+ wsgen \
+ wsimport \
+ xjc
+
+.PHONY: $(tools)
+
+$(tools):
+ $(MKDIR_P) "$(DESTDIR)/$(bindir)"
+ $(LN_S) $(pkglibexecdir)/run-java-tool.bash "$(DESTDIR)/$(bindir)/$@"
+
+install-exec-hook: $(tools)
+
diff --git a/configure.ac b/configure.ac
index 63bb832..cb1a32c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@ AC_PREREQ([2.68])
AC_CONFIG_SRCDIR([src/modules/java-vm.eselect.in])
AM_INIT_AUTOMAKE([1.11])
+AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
diff --git a/src/scripts/run-java-tool.bash b/src/scripts/run-java-tool.bash
new file mode 100644
index 0000000..57106a9
--- /dev/null
+++ b/src/scripts/run-java-tool.bash
@@ -0,0 +1,50 @@
+#!/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}/"
+# 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
+
+