Skip to content
This repository has been archived by the owner on Apr 9, 2019. It is now read-only.

Java8 #130

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Java8 #130

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 59 additions & 25 deletions oab-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function copyright_msg() {
if [ "${MODE}" == "build_docs" ]; then
echo "# OAB-Java"
fi
echo `basename ${0}`" v${VER} - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages."
echo `basename ${0}`" v${VER} - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 and/or Oracle Java 8 packages."
echo
echo "Copyright (c) Martin Wimpress, http://flexion.org. MIT License"
echo
Expand Down Expand Up @@ -220,6 +220,7 @@ function usage() {
echo "Optional parameters"
echo
echo " * -7 : Build ``oracle-java7`` packages instead of ``sun-java6``"
echo " * -8 : Build ``oracle-java8`` packages instead of ``sun-java6``"
echo " * -c : Remove pre-existing packages from ``${WORK_PATH}/deb`` and sources from ``${WORK_PATH}/src``."
echo " * -k <gpg-key-id> : Use the specified existing key instead of generating one"
echo " * -s : Skip building if the packages already exist"
Expand Down Expand Up @@ -254,6 +255,7 @@ function usage() {
echo
echo " * <https://github.com/rraptorr/sun-java6>"
echo " * <https://github.com/rraptorr/oracle-java7>"
echo " * <https://github.com/rraptorr/oracle-java8>"
echo
echo "The basic execution steps are:"
echo
Expand Down Expand Up @@ -282,6 +284,10 @@ function usage() {
echo
echo " sudo apt-get install oracle-java7-jre"
echo
echo "Or if you ran the script with the ``-8`` option."
echo
echo " sudo apt-get install oracle-java8-jre"
echo
echo "If you already have the *\"official\"* Ubuntu packages installed then you"
echo "can upgrade by executing the following from a shell."
echo
Expand All @@ -297,7 +303,7 @@ function usage() {
echo
echo "## Known Issues"
echo
echo " * Building Java 7 on Ubuntu Lucid 10.04 is no longer supported as the upstream scripts"
echo " * Building Java 7 or 8 on Ubuntu Lucid 10.04 is no longer supported as the upstream scripts"
echo " require ``debhelper``>=8 which is not officially available for Lucid."
echo " * The Oracle download servers can be horribly slow. My script caches the downloads"
echo " so you only need download each file once."
Expand Down Expand Up @@ -364,13 +370,13 @@ if [ -f $log ]; then
fi

# Parse the options
OPTSTRING=7bchk:st:
OPTSTRING=78bchk:st:
while getopts ${OPTSTRING} OPT
do
case ${OPT} in
7)
7|8)
JAVA_DEV="oracle-java"
JAVA_UPSTREAM="oracle-java7"
JAVA_UPSTREAM="oracle-java${OPT}"
;;
b) build_docs;;
c) BUILD_CLEAN=1;;
Expand All @@ -383,8 +389,8 @@ do
done
shift "$(( $OPTIND - 1 ))"

if [ "${JAVA_UPSTREAM}" == "oracle-java7" ] && [ "${LSB_CODE}" == "lucid" ]; then
ncecho " [!] Building Java 7 on Ubuntu Lucid is no longer supported "
if [ "${JAVA_DEV}" == "oracle-java" ] && [ "${LSB_CODE}" == "lucid" ]; then
ncecho " [!] Building Java 7 or 8 on Ubuntu Lucid is no longer supported "
cecho exitting
exit 1
fi
Expand Down Expand Up @@ -412,8 +418,12 @@ if [ "${LSB_ARCH}" == "amd64" ] && [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then
fi
fi

if [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then
BUILD_DEPS="${BUILD_DEPS} libxrender1"
if [ "${JAVA_UPSTREAM}" == "oracle-java8" ]; then
BUILD_DEPS="${BUILD_DEPS} libx11-6 libxext6"
fi

if [ "${JAVA_DEV}" == "oracle-java" ]; then
BUILD_DEPS="${BUILD_DEPS} libxrender1 curl"
fi

# Install the Java build requirements
Expand Down Expand Up @@ -468,32 +478,44 @@ DEB_URGENCY=`head -n1 ${WORK_PATH}/src/debian/changelog | cut -d'=' -f2`
JAVA_VER=`echo ${DEB_VERSION} | cut -d'.' -f1`
JAVA_UPD=`echo ${DEB_VERSION} | cut -d'.' -f2 | cut -d'-' -f1`

# The first Java8 release doesn't have a u[0-9]* part
if [ "${JAVA_UPD}" == "0" ]; then
JAVA_UPD=
else
JAVA_UPD="u${JAVA_UPD}"
fi

ncecho " [x] Getting releases download page "
if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then
wget http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html -O /tmp/oab-download.html >> "$log" 2>&1 &
else
elif [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then
wget http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html -O /tmp/oab-download.html >> "$log" 2>&1 &
else
wget http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html -O /tmp/oab-download.html >> "$log" 2>&1 &
fi
pid=$!;progress $pid

# Set the files we're downloading since sun-java6 and oracle-java7 differ.
# Set the files we're downloading since sun-java6 and oracle-java7/8 differ.
if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then
JAVA_EXT=.bin
else
JAVA_EXT=.tar.gz
fi
if grep -q ia32 ${WORK_PATH}/src/debian/rules; then
# Upstream still builds ia32 package, download both architectures
JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586${JAVA_EXT} jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}"
if grep -q 'srcdir.*:=.*$(arch)' ${WORK_PATH}/src/debian/rules; then
# Upstream requires binary files for both architectures
JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-i586${JAVA_EXT} jdk-${JAVA_VER}${JAVA_UPD}-linux-x64${JAVA_EXT}"
else
# Upstream has removed ia32 package, just download the appropriate one
# Upstream requires binary file of the machine's architecture only
if [ "${LSB_ARCH}" == "amd64" ]; then
JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}"
JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-x64${JAVA_EXT}"
else
JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586${JAVA_EXT}"
JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-i586${JAVA_EXT}"
fi
fi

# Cookies required for download
COOKIES="oraclelicense=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"

for JAVA_BIN in ${JAVA_BINS}
do
# Get the download URL and size
Expand All @@ -503,8 +525,6 @@ do
DOWNLOAD_URL=`grep ${JAVA_BIN} /tmp/oab-download.html | cut -d'{' -f2 | cut -d',' -f3 | cut -d'"' -f4`
fi
DOWNLOAD_SIZE=`grep ${JAVA_BIN} /tmp/oab-download.html | cut -d'{' -f2 | cut -d',' -f2 | cut -d':' -f2 | sed 's/"//g'`
# Cookies required for download
COOKIES="oraclelicensejdk-${JAVA_VER}u${JAVA_UPD}-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"

ncecho " [x] Downloading ${JAVA_BIN} : ${DOWNLOAD_SIZE} "
wget --no-check-certificate --header="Cookie: ${COOKIES}" -c "${DOWNLOAD_URL}" -O ${WORK_PATH}/pkg/${JAVA_BIN} >> "$log" 2>&1 &
Expand All @@ -516,13 +536,18 @@ do
done

# Get JCE download index
if [ $JAVA_VER == "7" ]; then
if [ "${JAVA_VER}" == "8" ]; then
DOWNLOAD_INDEX_NO='2133166'
DOWNLOAD_INDEX_JCE='jce'
elif [ "${JAVA_VER}" == "7" ]; then
DOWNLOAD_INDEX_NO='432124'
DOWNLOAD_INDEX_JCE='jce-'
else
DOWNLOAD_INDEX_NO='429243'
DOWNLOAD_INDEX_JCE='jce-'
fi

DOWNLOAD_INDEX="technetwork/java/javase/downloads/jce-${JAVA_VER}-download-${DOWNLOAD_INDEX_NO}.html"
DOWNLOAD_INDEX="technetwork/java/javase/downloads/${DOWNLOAD_INDEX_JCE}${JAVA_VER}-download-${DOWNLOAD_INDEX_NO}.html"
wget http://www.oracle.com/${DOWNLOAD_INDEX} -O /tmp/oab-download-jce.html >> "$log" 2>&1 &
pid=$!;progress $pid

Expand All @@ -531,11 +556,13 @@ if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then
JCE_POLICY="jce_policy-6.zip"
DOWNLOAD_PATH=`grep "jce[^']*-6-oth-JPR'\]\['path" /tmp/oab-download-jce.html | cut -d'=' -f2 | cut -d'"' -f2`
DOWNLOAD_URL="${DOWNLOAD_PATH}${JCE_POLICY}"
COOKIES="oraclelicense=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"
else
JCE_POLICY="UnlimitedJCEPolicyJDK7.zip"
elif [ "${JAVA_DEV}" == "oracle-java" ]; then
if [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then
JCE_POLICY="UnlimitedJCEPolicyJDK7.zip"
else
JCE_POLICY="jce_policy-8.zip"
fi
DOWNLOAD_URL=`grep ${JCE_POLICY} /tmp/oab-download-jce.html | cut -d'{' -f2 | cut -d',' -f3 | cut -d'"' -f4`
COOKIES="oraclelicensejce-7-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"
fi
DOWNLOAD_SIZE=`grep ${JCE_POLICY} /tmp/oab-download-jce.html | cut -d'{' -f2 | cut -d',' -f2 | cut -d'"' -f4`

Expand All @@ -562,6 +589,13 @@ BUILD_MESSAGE="Automated build for ${LSB_REL} using https://github.com/rraptorr/
# Change directory to the build directory
cd ${WORK_PATH}/src

# Run upstream's preparing script if it exists
if [ -f prepare.sh ]; then
ncecho " [x] Inflating archives "
./prepare.sh >> "$log" 2>&1 &
pid=$!;progress $pid
fi

# Update the changelog
ncecho " [x] Updating the changelog "
dch --distribution ${LSB_CODE} --force-distribution --newversion ${NEW_VERSION} --force-bad-version --urgency=${DEB_URGENCY} "${BUILD_MESSAGE}" >> "$log" 2>&1 &
Expand Down