aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2015-12-30 13:36:21 +0000
committerJames Le Cuirot <chewi@gentoo.org>2015-12-31 23:55:53 +0000
commit9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4 (patch)
treee4e078736318be1b884b74b16aeba4f5aaa27681
parentUpdate year (diff)
downloadeselect-java-9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4.tar.gz
eselect-java-9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4.tar.bz2
eselect-java-9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4.zip
Make run-java-tool.bash POSIX-compliant
But keep the .bash extension to avoid breaking existing systems.
-rw-r--r--src/scripts/run-java-tool.bash.in34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/scripts/run-java-tool.bash.in b/src/scripts/run-java-tool.bash.in
index d6b41d4..49db910 100644
--- a/src/scripts/run-java-tool.bash.in
+++ b/src/scripts/run-java-tool.bash.in
@@ -1,44 +1,44 @@
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+#!@GENTOO_PORTAGE_EPREFIX@/bin/sh
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
+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})
+elif [ -h "${user_vm}" ]; then
+ vmpath=$(readlink "${user_vm}")
# And fall back to the system VM
else
- vmpath=$(readlink ${system_vm})
+ vmpath=$(readlink "${system_vm}")
fi
-tool=$(basename $0)
+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=$(basename "${vmpath}")
+if [ -x "${bin}" ]; then
+ exec "${bin}" "${@}"
+elif [ -x "${jrebin}" ]; then
+ exec "${jrebin}" "${@}"
else
- if [[ ! -d ${vmpath} ]]; then
+ if [ ! -d "${vmpath}" ]; then
echo "* Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2
- if [[ -n ${GENTOO_VM} ]]; then
+ if [ -n "${GENTOO_VM}" ]; then
echo "* Invalid value for GENTOO_VM: ${GENTOO_VM}"
- elif [[ -h ${user_vm} ]]; then
+ 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
+ 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
+ if [ "$(id -u)" != 0 ] && [ -n "${DISPLAY}" ] && type 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
@@ -46,5 +46,3 @@ else
fi
exit 1
fi
-
-