JAL-3227 helper shell scripts for setting up a build environment
[jalview.git] / utils / download_jres.sh
similarity index 87%
rename from utils/install4j/download_jres.sh
rename to utils/download_jres.sh
index 0a1cf9f..8b8abc3 100755 (executable)
@@ -19,6 +19,8 @@ HEAP_SIZE=normal
 VENDOR=adoptopenjdk
 IMAGE_TYPE=jre
 
+STRIP_MAC_APP_BUNDLING=false
+
 RM=/bin/rm
 
 # unzip-strip from https://superuser.com/questions/518347/equivalent-to-tars-strip-components-1-in-unzip
@@ -49,7 +51,7 @@ for FEATURE_VERSION in 8 11; do
         continue;
       fi
       echo "Unpacking ${TARFILE}"
-      JREDIR="${NAME}/jre"
+      JREDIR="${NAME}/${IMAGE_TYPE}"
       [ x$NAME != x -a -e "${JREDIR}" ] && $RM -rf "${JREDIR}"
       mkdir -p "${JREDIR}"
       if [ x$OS = xwindows ]; then
@@ -58,8 +60,13 @@ for FEATURE_VERSION in 8 11; do
         RET=$?
       else
         echo "using tar"
-        tar --strip-components=1 -C "${JREDIR}" -zxf "${TARFILE}"
-        RET=$?
+        if [ x$OS = xmac -a x$STRIP_MAC_APP_BUNDLING = xtrue ]; then
+          tar --strip-components=3 -C "${JREDIR}" -zxf "${TARFILE}" "*/Contents/Home"
+          RET=$?
+        else
+          tar --strip-components=1 -C "${JREDIR}" -zxf "${TARFILE}"
+          RET=$?
+        fi
       fi
       if [ "$RET" != 0 ]; then
         echo "Error unpacking ${TARFILE}"