Skip to content

Commit

Permalink
Fix JDK download and install for Mac OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
bjagg committed Apr 18, 2017
1 parent 74e13bc commit 1a69604
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
5 changes: 5 additions & 0 deletions download-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ fi
# Source versions to use
. `dirname ${0}`/versions.properties

# Handle OSX file ending with
if [[ "macosx-x64" = "$JDK_OS" ]]; then
JDK_FILE=jdk-${JDK_VER}-${JDK_OS}.dmg
fi

# Source dev properties if found
DEV_PROPS=$(dirname ${0})/dev.properties
if [ -f $DEV_PROPS ]; then
Expand Down
22 changes: 21 additions & 1 deletion set-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ if [ -f $DEV_PROPS ]; then
. $DEV_PROPS
fi

# Handle OSX file ending with .dmg
if [[ "macosx-x64" = "$JDK_OS" ]]; then
JDK_FILE=jdk-${JDK_VER}-${JDK_OS}.dmg
fi

# Determine download dir
DL_DIR="$DOWNLOAD_DIR"
if [ -d "$2" ]; then
DL_DIR="$2"
fi

UNTAR="tar xzf"

if [ ! -d "$TOOLS_DIR" ]; then
mkdir -p $TOOLS_DIR
fi
cd $TOOLS_DIR

# Setup Ant
Expand All @@ -40,4 +49,15 @@ $UNTAR ${DL_DIR}/${ANT_FILE} && ln -s ${ANT_DIR} ant
$UNTAR ${DL_DIR}/${MAVEN_FILE} && ln -s ${MAVEN_DIR} maven

# Setup JDK
$UNTAR ${DL_DIR}/${JDK_FILE} && ln -s ${JDK_DIR} java
if [[ "macosx-x64" = "$JDK_OS" ]]; then
hdiutil attach "${DL_DIR}/${JDK_FILE}"
sudo installer -package "${JDK_PKG}" -target /
hdiutil detach "${JDK_VOL}"
echo ln -s `/usr/libexec/java_home -R` java
if [ -f java ]; then
rm java
fi
ln -s `/usr/libexec/java_home -R` java
else
$UNTAR ${DL_DIR}/${JDK_FILE} && ln -s ${JDK_DIR} java
fi
12 changes: 9 additions & 3 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ ANT_FILE=apache-ant-${ANT_VER}-bin.tar.gz
MAVEN_VER=3.3.9
MAVEN_DIR=apache-maven-${MAVEN_VER}
MAVEN_FILE=apache-maven-${MAVEN_VER}-bin.tar.gz
JDK_LONG_VER=8u112-b15
JDK_VER=8u112
JDK_DIR=jdk1.8.0_112
# JDK_LONG_VER=8u131-b11
# JDK_VER=8u131
# JDK_DIR=jdk1.8.0_131
# JDK_LONG_VER=8u121-b13
# JDK_VER=8u121
# JDK_DIR=jdk1.8.0_121
JDK_LONG_VER=8u112-b15
JDK_VER=8u112
JDK_DIR=jdk1.8.0_112
JDK_FILE=jdk-${JDK_VER}-${JDK_OS}.tar.gz
# only needed for macosx
JDK_VOL="/Volumes/JDK 8 Update 112"
JDK_PKG="${JDK_VOL}/JDK 8 Update 112.pkg"
TOMCAT_VER=8.5.11
TOMCAT_DIR=apache-tomcat-${TOMCAT_VER}
TOMCAT_FILE=apache-tomcat-${TOMCAT_VER}.tar.gz

0 comments on commit 1a69604

Please sign in to comment.