From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8462B1388C1 for ; Fri, 1 Jan 2016 00:03:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A05ED21C00B; Fri, 1 Jan 2016 00:03:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4311821C00B for ; Fri, 1 Jan 2016 00:03:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 62A3B34094F for ; Fri, 1 Jan 2016 00:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 13248CB0 for ; Fri, 1 Jan 2016 00:03:39 +0000 (UTC) From: "James Le Cuirot" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "James Le Cuirot" Message-ID: <1451606153.9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4.chewi@gentoo> Subject: [gentoo-commits] proj/eselect-java:master commit in: src/scripts/ X-VCS-Repository: proj/eselect-java X-VCS-Files: src/scripts/run-java-tool.bash.in X-VCS-Directories: src/scripts/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: 9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4 X-VCS-Branch: master Date: Fri, 1 Jan 2016 00:03:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 16dd9ca5-334f-4cca-9757-020c92bc0d5c X-Archives-Hash: 5fb60ad931a464a287a872fdd4c50a00 commit: 9c9806ea10aa18db4d08e5e3ade73b0c7d9e21e4 Author: James Le Cuirot gentoo org> AuthorDate: Wed Dec 30 13:36:21 2015 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Thu Dec 31 23:55:53 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=9c9806ea Make run-java-tool.bash POSIX-compliant But keep the .bash extension to avoid breaking existing systems. src/scripts/run-java-tool.bash.in | 34 ++++++++++++++++------------------ 1 file 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" "${tool} is not available for ${vm_handle} Gentoo Java User Guide" fi @@ -46,5 +46,3 @@ else fi exit 1 fi - -