JAL-3252 download-jres.sh helper script for keeping JREs for all platforms up to...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Feb 2020 16:35:05 +0000 (16:35 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Feb 2020 16:35:05 +0000 (16:35 +0000)
utils/download_jres.sh

index 8b8abc3..5bfc26d 100755 (executable)
@@ -20,6 +20,8 @@ VENDOR=adoptopenjdk
 IMAGE_TYPE=jre
 
 STRIP_MAC_APP_BUNDLING=false
+CREATE_ARCHIVES="zip tgz"
+# need zip with top-level jre dir for getdown updates. need tgz without top-level jre dir for install4j bundling
 
 RM=/bin/rm
 
@@ -73,10 +75,33 @@ for FEATURE_VERSION in 8 11; do
         exit 1
       fi
       $RM "${TARFILE}"
-      echo "Creating .tar.gz for install4j bundling and updates"
-      TGZDIR=tgz
-      mkdir -p "${TGZDIR}"
-      tar -C "${JREDIR}" -zcf "${TGZDIR}/${NAME}.tar.gz" .
+      if [ \! -z "$CREATE_ARCHIVES" ]; then
+        for CREATEARCHIVE in ${CREATE_ARCHIVES}; do
+          ARCHIVEDIR=$CREATEARCHIVE
+          case $CREATEARCHIVE in
+            zip)
+              EXT=${CREATEARCHIVE}
+              echo "Creating ${NAME}.${EXT} for getdown updates"
+              [ \! -d ${ARCHIVEDIR} ] && mkdir -p "${ARCHIVEDIR}"
+              ABSARCHIVEDIR="${PWD}/$ARCHIVEDIR"
+              ZIPFILE="${ABSARCHIVEDIR}/${NAME}.${CREATEARCHIVE}"
+              [ -e "${ZIPFILE}" ] && $RM "${ZIPFILE}"
+              cd ${NAME}
+              zip -X -r "${ZIPFILE}" "${IMAGE_TYPE}"
+              cd -
+              ;;
+            tgz)
+              EXT=tar.gz
+              echo "Creating ${NAME}.${EXT} for install4j bundling"
+              [ \! -d ${ARCHIVEDIR} ] && mkdir -p "${ARCHIVEDIR}"
+              tar -C "${JREDIR}" -zcf "${ARCHIVEDIR}/${NAME}.${EXT}" .
+              ;;
+            *)
+              echo "Archiving as '${CREATEARCHIVE}' file not supported"
+              ;;
+          esac
+        done
+      fi
     done
   done
 done