Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect-java:master commit in: src/scripts/
Date: Fri, 01 Jan 2016 00:03:45
Message-Id: 1451606153.9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4.chewi@gentoo
1 commit: 9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 30 13:36:21 2015 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 31 23:55:53 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=9c9806ea
7
8 Make run-java-tool.bash POSIX-compliant
9
10 But keep the .bash extension to avoid breaking existing systems.
11
12 src/scripts/run-java-tool.bash.in | 34 ++++++++++++++++------------------
13 1 file changed, 16 insertions(+), 18 deletions(-)
14
15 diff --git a/src/scripts/run-java-tool.bash.in b/src/scripts/run-java-tool.bash.in
16 index d6b41d4..49db910 100644
17 --- a/src/scripts/run-java-tool.bash.in
18 +++ b/src/scripts/run-java-tool.bash.in
19 @@ -1,44 +1,44 @@
20 -#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
21 +#!@GENTOO_PORTAGE_EPREFIX@/bin/sh
22
23 user_vm="${HOME}/.gentoo@GENTOO_PORTAGE_EPREFIX@/java-config-2/current-user-vm"
24 system_vm="@GENTOO_PORTAGE_EPREFIX@/etc/java-config-2/current-system-vm"
25 # Try GENTOO_VM
26 -if [[ -n ${GENTOO_VM} ]]; then
27 +if [ -n "${GENTOO_VM}" ]; then
28 vmpath="@GENTOO_PORTAGE_EPREFIX@/usr/lib/jvm/${GENTOO_VM}/"
29 # Then user VM
30 -elif [[ -h ${user_vm} ]]; then
31 - vmpath=$(readlink ${user_vm})
32 +elif [ -h "${user_vm}" ]; then
33 + vmpath=$(readlink "${user_vm}")
34 # And fall back to the system VM
35 else
36 - vmpath=$(readlink ${system_vm})
37 + vmpath=$(readlink "${system_vm}")
38 fi
39 -tool=$(basename $0)
40 +tool=$(basename "$0")
41 bin=${vmpath}/bin/${tool}
42 jrebin=${vmpath}/jre/bin/${tool}
43
44 -vm_handle=$(basename ${vmpath})
45 -if [[ -x ${bin} ]]; then
46 - exec ${bin} "${@}"
47 -elif [[ -x ${jrebin} ]]; then
48 - exec ${jrebin} "${@}"
49 +vm_handle=$(basename "${vmpath}")
50 +if [ -x "${bin}" ]; then
51 + exec "${bin}" "${@}"
52 +elif [ -x "${jrebin}" ]; then
53 + exec "${jrebin}" "${@}"
54 else
55 - if [[ ! -d ${vmpath} ]]; then
56 + if [ ! -d "${vmpath}" ]; then
57 echo "* Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2
58 - if [[ -n ${GENTOO_VM} ]]; then
59 + if [ -n "${GENTOO_VM}" ]; then
60 echo "* Invalid value for GENTOO_VM: ${GENTOO_VM}"
61 - elif [[ -h ${user_vm} ]]; then
62 + elif [ -h "${user_vm}" ]; then
63 echo "* Invalid User VM: ${vm_handle}" >&2
64 else
65 echo "* Invalid System VM: ${vm_handle}" >&2
66 fi
67 else
68 - if [[ ${tool} = "run-java-tool.bash" ]]; then
69 + if [ "${tool}" = "run-java-tool.bash" ]; then
70 echo "* run-java-tool was invoked directly" >&2
71 echo "* run-java-tool should only be used via symlinks to it" >&2
72 else
73 echo "* ${tool} is not available for ${vm_handle} on $(uname -m)" >&2
74 echo "* IMPORTANT: some Java tools are not available on some VMs on some architectures" >&2
75 - if (( ${EUID} != 0 )) && [[ "${DISPLAY}" ]] && type -p notify-send > /dev/null; then
76 + if [ "$(id -u)" != 0 ] && [ -n "${DISPLAY}" ] && type notify-send > /dev/null; then
77 notify-send -i java-icon48 "Gentoo Java Launcher" "<b>${tool}</b> is not available for ${vm_handle}
78 <a href=\"http://www.gentoo.org/doc/en/java.xml\">Gentoo Java User Guide</a>"
79 fi
80 @@ -46,5 +46,3 @@ else
81 fi
82 exit 1
83 fi
84 -
85 -