From: Ben Soares Date: Wed, 16 Aug 2023 16:48:00 +0000 (+0100) Subject: JAL-4160 JAL-3830 Improvements to the jalview.sh bash script especially when not... X-Git-Tag: Release_2_11_4_0~199^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=42e022a59de649375c8878c1d26361cb6bc89cb8;p=jalview.git JAL-4160 JAL-3830 Improvements to the jalview.sh bash script especially when not in .app bundle on mac. --- diff --git a/utils/getdown/bin/jalview.sh b/utils/getdown/bin/jalview.sh index 07fd6ed..371bfcd 100755 --- a/utils/getdown/bin/jalview.sh +++ b/utils/getdown/bin/jalview.sh @@ -38,13 +38,35 @@ fi # check for headless mode HEADLESS=0 +GUI=0 +HELP=0 +DEBUG=0 for ARG in "${@}"; do - if [ "${ARG}" = "--headless" ]; then + case "${ARG}" in + "--headless") + HEADLESS=1 + ;; + "--help") + HELP=1 + ;; + --help-*) + HELP=1 + ;; + "--gui") + GUI=1 + ;; + "--debug") + DEBUG=1 + ;; + esac + + if [ "${HELP}" = 1 ]; then + # --help takes precedence HEADLESS=1 - elif [ "${ARG}" = "--gui" ]; then + GUI=0 + elif [ "${GUI}" = 1 ]; then # --gui takes precedence over --headless HEADLESS=0 - break fi done @@ -54,12 +76,7 @@ declare -a JVMARGS=() if [ "${ISMACOS}" = 1 ]; then # MACOS ONLY DIR="$(dirname "$(readlinkf "$0")")" - APP="${DIR%.app/Contents/*}".app - if [ "${APP}" = "${APP%.app}" ]; then - echo "Could not find Jalview.app" >&2 - exit 2 - fi - APPDIR="${APP}/Contents/Resources/app" + APPDIR="${DIR%/bin}" JAVA="${APPDIR}/jre/Contents/Home/bin/java" JVMARGS=( "${JVMARGS[@]}" "-Xdock:icon=${APPDIR}/resource/jalview_logo.png" ) else @@ -148,4 +165,8 @@ if [ \! -e "${JAVA}" ]; then echo "Cannot find bundled java, using system ${JAVA} and hoping for the best!" >&2 fi +if [ "${DEBUG}" = 1 ]; then + echo Shell running: \""${JAVA}"\" \""${JVMARGS[@]}"\" -cp \""${CLASSPATH}"\" jalview.bin.Launcher "${ARGS[@]}" +fi + "${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher "${ARGS[@]}"