From: Ben Soares Date: Thu, 16 May 2024 13:44:36 +0000 (+0100) Subject: JAL-4409 Easier full install from source for macOS X-Git-Tag: Release_2_11_4_0~28^2~24 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a418d58ddc2e8b5748fddd5ef0795c3a4a37c310;p=jalview.git JAL-4409 Easier full install from source for macOS --- diff --git a/utils/dev_macos_install.sh b/utils/dev_macos_install.sh index e46f524..80cb94d 100755 --- a/utils/dev_macos_install.sh +++ b/utils/dev_macos_install.sh @@ -1,16 +1,104 @@ #!/usr/bin/env bash # perform a dev build and install on local macOS machine -INSTALLERVOL="Jalview Non-Release Installer" -APP="Jalview Local.app" - +APP="" +INSTALLERVOL="" APPLICATIONS=/Applications -CHANNEL=NOCHANNEL +CHANNEL="LOCAL" DMG=build/install4j/11/Jalview_Local-TEST-macos-java_11.dmg +GRADLE="" +APPBASEOVERRIDEARG="" +MEDIA=macosArchive +CLEAN="clean" +JAVA=11 +x=$(grep jalview.version= RELEASE) +VERSION=${x#*=} +while getopts ":i:n:a:c:d:go:m:j:l" opt; do + case ${opt} in + i) + INSTALLERVOL="${OPTARG}" + ;; + n) + APP="${OPTARG}" + ;; + a) + APPLICATIONS="${OPTARG}" + ;; + c) + CHANNEL="${OPTARG}" + ;; + d) + DMG="${OPTARG}" + ;; + g) + GRADLE=1 + ;; + o) + APPBASEOVERRIDEARG="-Pgetdown_appbase_override=${OPTARG}" + ;; + m) + MEDIA="${OPTARG}" + ;; + j) + JAVA="${OPTARG}" + ;; + l) + CLEAN="" + ;; + ?) + echo "Invalid option -${OPTARG}" + exit 1; + ;; + esac +done -if [ x$1 != "xnogradle" ]; then - gradle installers -PCHANNEL=LOCAL -Pinstall4j_media_types=macosArchive +if [ -z $APP ]; then + ARCH=x64 + if [ $(uname -m) = "arm64" ]; then + ARCH=aarch64 + fi + OS=macos + case $(uname -o) in + Darwin) + OS=macos + ;; + Windows) + OS=windows + ;; + Linux) + OS=linux + ;; + *) + OS=unix + ;; + esac + case ${CHANNEL} in + DEVELOP) + APP="Jalview Develop" + DMG="build/install4j/11/${APP// /_}-${VERSION//\./_}-d$(date +%Y%m%d)-${OS}-${ARCH}-java_${JAVA}.dmg" + ;; + TEST-RELEASE) + APP="Jalview Test" + DMG="build/install4j/11/${APP// /_}-${VERSION//\./_}-test-${OS}-${ARCH}-java_${JAVA}.dmg" + ;; + RELEASE) + APP="Jalview" + DMG="build/install4j/11/${APP// /_}-${VERSION//\./_}-${OS}-${ARCH}-java_${JAVA}.dmg" + ;; + *) + APP="Jalview Local" + DMG=build/install4j/11/${APP// /_}-TEST-macos-java_11.dmg + ;; + esac +fi +if [ -z $INSTALLERVOL ]; then + INSTALLERVOL="${APP} Installer" +fi + +if [ "${GRADLE}" = 1 ]; then + echo "Running: gradle ${CLEAN} installers -PCHANNEL="${CHANNEL}" -Pinstall4j_media_types="${MEDIA}" ${APPBASEOVERRIDEARG} -PJAVA_VERSION=${JAVA}" + gradle ${CLEAN} installers -PCHANNEL="${CHANNEL}" -Pinstall4j_media_types="${MEDIA}" ${APPBASEOVERRIDEARG} -PJAVA_VERSION=${JAVA} else echo "Not running gradle installers" fi @@ -21,23 +109,29 @@ if [ $? = 0 ]; then open $DMG else echo "No DMG file '$DMG'" 1>&2 - exit 1 + exit 2 fi echo "Mounting '$DMG' at /Volumes" N=0 - while [ \! -e "/Volumes/$INSTALLERVOL/$APP" ]; do + MOUNTEDAPP="/Volumes/$INSTALLERVOL/$APP.app" + echo "Waiting for '$MOUNTEDAPP' to appear" + while [ \! -e "$MOUNTEDAPP" ]; do if [ $(( N%1000 )) = 0 ]; then echo -n "." fi N=$(( N+1 )) done echo "" +else + echo "Problem with gradle build: exit code $?" + exit 3 fi -if [ -e "/Volumes/$INSTALLERVOL/$APP" ]; then - echo "Removing '$APPLICATIONS/$APP'" - /bin/rm -r "$APPLICATIONS/$APP" - echo "Syncing '/Volumes/$INSTALLERVOL/$APP' to '$APPLICATIONS/'" - rsync -avh "/Volumes/$INSTALLERVOL/$APP" "$APPLICATIONS/" + +if [ -e "$MOUNTEDAPP" ]; then + echo "Removing '$APPLICATIONS/$APP.app'" + /bin/rm -r "$APPLICATIONS/$APP.app" + echo "Syncing '$MOUNTEDAPP' to '$APPLICATIONS/'" + rsync -avh "$MOUNTEDAPP" "$APPLICATIONS/" echo "Unmounting '/Volumes/$INSTALLERVOL'" umount "/Volumes/$INSTALLERVOL" fi