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

Commit

Permalink
Added support for Java6u31 when the upstream script tags it as stable…
Browse files Browse the repository at this point in the history
…. Other fixes and improveents, closes #3, closes #4, closes #7 and closes #8.
  • Loading branch information
flexiondotorg committed Feb 17, 2012
1 parent e9a6a11 commit 1f84a69
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 59 deletions.
16 changes: 16 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
History
=======

0.1.6
-----

* Fixed downloading of common.sh when ca-certificates is not installed.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/3
* Updated to support Java6u31.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/7
- Closes : https://github.com/flexiondotorg/oab-java6/issues/8
- NOTE! Requires that the upstream script tags Java6u31 as stable, see the
following ticket https://github.com/rraptorr/sun-java6/issues/3
* Prevent script from running under Ubuntu Precise as it is currently
known to be unsupported.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/4
* Prevent automated key generation when running in an OpenVZ
container because I'm too stupid to work out a proper solution.

0.1.5
-----

Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
License
=======

Create a local 'apt' repository for Ubuntu Java packages.
Copyright (c) 2012 Martin Wimpress, http://flexion.org/

Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
23 changes: 21 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
oab-java6.sh v0.1.5 - Create a local 'apt' repository for Ubuntu Java packages.
oab-java6.sh v0.1.6 - Create a local 'apt' repository for Ubuntu Java packages.
Copyright (c) 2012 Flexion.Org, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
Expand Down Expand Up @@ -86,6 +86,22 @@ Because, O.A.B! ;-)
History
=======

0.1.6
-----

* Fixed downloading of common.sh when ca-certificates is not installed.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/3
* Updated to support Java6u31.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/7
- Closes : https://github.com/flexiondotorg/oab-java6/issues/8
- NOTE! Requires that the upstream script tags Java6u31 as stable, see the
following ticket https://github.com/rraptorr/sun-java6/issues/3
* Prevent script from running under Ubuntu Precise as it is currently
known to be unsupported.
- Closes : https://github.com/flexiondotorg/oab-java6/issues/4
* Prevent automated key generation when running in an OpenVZ
container because I'm too stupid to work out a proper solution.

0.1.5
-----

Expand Down Expand Up @@ -137,13 +153,16 @@ History
Todo
====

* Remove automatic signing key generation and add support for selecting a
pre-existing signing key.
* Add support to build for a given Ubuntu distribution.
* Add support to optionally build using 'pbuilder'.
* Dynamically determine the download URLs for the Java installers.
* Add support for Java 7.

License
=======

Create a local 'apt' repository for Ubuntu Java packages.
Copyright (c) 2012 Martin Wimpress, http://flexion.org/

Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
Todo
====

* Remove automatic signing key generation and add support for selecting a
pre-existing signing key.
* Add support to build for a given Ubuntu distribution.
* Add support to optionally build using 'pbuilder'.
* Dynamically determine the download URLs for the Java installers.
* Add support for Java 7.
128 changes: 72 additions & 56 deletions oab-java6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# - http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html

# Variables
VER="0.1.5"
VER="0.1.6"

function copyright_msg() {
local MODE=${1}
Expand Down Expand Up @@ -119,7 +119,7 @@ function usage() {
echo "Known Issues"
echo "============"
echo
echo " - The Oracle download servers can be horribly slow. My script caches the"
echo " - The Oracle download servers can be horribly slow. My script caches the"
echo " downloads so you only need download each file once."
echo " - This script doesn't dynamically determine the download URLs for the"
echo " Java installers released by Oracle. Currently, when a new Java version is"
Expand Down Expand Up @@ -173,10 +173,10 @@ if [ -r /tmp/common.sh ]; then
exit 1
else
update_thyself
fi
fi
else
echo "Downloading common.sh"
wget -q "https://github.com/flexiondotorg/common/raw/master/common.sh" -O /tmp/common.sh
wget --no-check-certificate -q "https://github.com/flexiondotorg/common/raw/master/common.sh" -O /tmp/common.sh
chmod 666 /tmp/common.sh
source /tmp/common.sh
if [ $? -ne 0 ]; then
Expand All @@ -191,13 +191,20 @@ check_root
check_sudo
check_ubuntu "all"

if [ "${LSB_CODE}" == "precise" ]; then
error_msg
fi

BUILD_KEY=""

# Parse the options
OPTSTRING=bh
OPTSTRING=bhk
while getopts ${OPTSTRING} OPT
do
case ${OPT} in
b) build_docs;;
h) usage;;
k) BUILD_KEY=${OPTARG};;
*) usage;;
esac
done
Expand All @@ -211,7 +218,8 @@ if [ -e /etc/apt/sources.list.d/flexiondotorg-java-${LSB_CODE}.list ]; then
fi

# Determine the build and runtime requirements.
BUILD_DEPS="build-essential debhelper defoma devscripts dpkg-dev git-core gnupg libasound2 libxi6 libxt6 libxtst6 rng-tools unixodbc unzip"
BUILD_DEPS="build-essential debhelper defoma devscripts dpkg-dev git-core \
gnupg imvirt libasound2 libxi6 libxt6 libxtst6 rng-tools unixodbc unzip"
if [ "${LSB_ARCH}" == "amd64" ]; then
BUILD_DEPS="${BUILD_DEPS} lib32asound2 ia32-libs"
fi
Expand Down Expand Up @@ -242,30 +250,36 @@ cd /var/local/oab/ >> "$log" 2>&1
git clone git://github.com/rraptorr/sun-java6.git src >> "$log" 2>&1 &
pid=$!;progress $pid

# Get the last commit tag.
cd /var/local/oab/src >> "$log" 2>&1
TAG=`git tag -l | tail -n1`

# Check the tagged, stable, version.
ncecho " [x] Checking out ${TAG} "
git checkout ${TAG} >> "$log" 2>&1 &
pid=$!;progress $pid

# Cet the current Debian package version and package urgency
DEB_VERSION=`head -n1 /var/local/oab/src/debian/changelog | cut -d'(' -f2 | cut -d')' -f1 | cut -d'~' -f1`
DEB_URGENCY=`head -n1 /var/local/oab/src/debian/changelog | cut -d'=' -f2`
DEB_URGENCY=`head -n1 /var/local/oab/src/debian/changelog | cut -d'=' -f2`

# Determine the currently supported Java version and update
JAVA_VER=`echo ${DEB_VERSION} | cut -d'.' -f1`
JAVA_UPD=`echo ${DEB_VERSION} | cut -d'.' -f2 | cut -d'-' -f1`

# Determine the JAVA_REL based on known Java releases
if [ "${JAVA_VER}" != "6" ] && [ "${JAVA_UPD}" != "30" ]; then
error_msg "ERROR! A new version of Java has been released. Update this script!"
fi

# Damn it, if it weren't for having to know the release number this could be
# Determine the JAVA_REL for known Java releases
# Damn it, if it weren't for having to know the release number this could be
# entirely dynamic!
JAVA_REL="b12"

# Checkout the latest tagged release
cd /var/local/oab/src >> "$log" 2>&1
TAG=`git tag -l v${JAVA_VER}.${JAVA_UPD}-* | tail -n1`

ncecho " [x] Checking out ${TAG} "
git checkout ${TAG} >> "$log" 2>&1 &
pid=$!;progress $pid
# - http://www.oracle.com/technetwork/java/javase/downloads/index.html

This comment has been minimized.

Copy link
@mikkorantalainen

mikkorantalainen Feb 17, 2012

How about something like this:

JAVA_VER="6"
RELEASE_PAGE_URL=$(wget -qO- "http://www.oracle.com/technetwork/java/javase/downloads/index.html" | perl -ne 'if (m@/technetwork/java/javase/downloads/jdk-6u[0-9]+-download-[0-9]+.html@) { s@.*(/technetwork/java/javase/downloads/jdk-6u[0-9]+-download-[0-9]+.html).*@http://www.oracle.com$1@; print}')
JAVA_UPD=$(wget -qO- "$RELEASE_PAGE_URL" | perl -ne 'if (m@http://download.oracle.com/otn-pub/java/jdk/6u[0-9]+-b[0-9]+/jdk-6u[0-9]+-linux-i586.bin@) { s@.*http://download.oracle.com/otn-pub/java/jdk/6u([0-9]+)-b[0-9]+/jdk-6u[0-9]+-linux-i586.bin.*@$1@; print}')
JAVA_REL=$(wget -qO- "$RELEASE_PAGE_URL" | perl -ne 'if (m@http://download.oracle.com/otn-pub/java/jdk/6u[0-9]+-b[0-9]+/jdk-6u[0-9]+-linux-i586.bin@) { s@.*http://download.oracle.com/otn-pub/java/jdk/6u[0-9]+-(b[0-9]+)/jdk-6u[0-9]+-linux-i586.bin.*@$1@; print}')

(Sorry for the long lines and poor performance because of not using temporary files...)

This comment has been minimized.

Copy link
@flexiondotorg

flexiondotorg via email Feb 18, 2012

Author Owner
if [ "${JAVA_VER}" == "6" ]; then
if [ "${JAVA_UPD}" == "30" ]; then
JAVA_REL="b12"
elif [ "${JAVA_UPD}" == "31" ]; then
JAVA_REL="b04"
else
error_msg "ERROR! A new version of Java has been released. Please raise a ticket - https://github.com/flexiondotorg/oab-java6/issues/new"
fi
fi

# Download the Oracle install packages.
for JAVA_BIN in jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586.bin jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64.bin
Expand Down Expand Up @@ -344,42 +358,45 @@ do
done
cecho success

# Do we need to create signing keys
if [ ! -e /var/local/oab/gpg/pubring.gpg ] && [ ! -e /var/local/oab/gpg/secring.gpg ] && [ ! -e /var/local/oab/gpg/trustdb.gpg ]; then

ncecho " [x] Create GnuPG configuration "
echo "Key-Type: DSA" > /var/local/oab/gpg-key.conf
echo "Key-Length: 1024" >> /var/local/oab/gpg-key.conf
echo "Subkey-Type: ELG-E" >> /var/local/oab/gpg-key.conf
echo "Subkey-Length: 2048" >> /var/local/oab/gpg-key.conf
echo "Name-Real: `hostname --fqdn`" >> /var/local/oab/gpg-key.conf
echo "Name-Email: root@`hostname --fqdn`" >> /var/local/oab/gpg-key.conf
echo "Expire-Date: 0" >> /var/local/oab/gpg-key.conf
cecho success

# Stop the system 'rngd'.
/etc/init.d/rng-tools stop >> "$log" 2>&1

ncecho " [x] Start generating entropy "
rngd -r /dev/urandom -p /tmp/rngd.pid >> "$log" 2>&1 &
pid=$!;progress $pid

ncecho " [x] Creating signing key "
gpg --homedir /var/local/oab/gpg --batch --gen-key /var/local/oab/gpg-key.conf >> "$log" 2>&1 &
pid=$!;progress $pid

ncecho " [x] Stop generating entropy "
kill -9 `cat /tmp/rngd.pid` >> "$log" 2>&1 &
pid=$!;progress $pid
rm /tmp/rngd.pid 2>/dev/null

# Start the system 'rngd'.
/etc/init.d/rng-tools start >> "$log" 2>&1
# Skip anything todo with automated key creation if this script is running in
# an OpenVZ container.
if [ `imvirt` != "OpenVZ" ]; then
# Do we need to create signing keys
if [ ! -e /var/local/oab/gpg/pubring.gpg ] && [ ! -e /var/local/oab/gpg/secring.gpg ] && [ ! -e /var/local/oab/gpg/trustdb.gpg ]; then

ncecho " [x] Create GnuPG configuration "
echo "Key-Type: DSA" > /var/local/oab/gpg-key.conf
echo "Key-Length: 1024" >> /var/local/oab/gpg-key.conf
echo "Subkey-Type: ELG-E" >> /var/local/oab/gpg-key.conf
echo "Subkey-Length: 2048" >> /var/local/oab/gpg-key.conf
echo "Name-Real: `hostname --fqdn`" >> /var/local/oab/gpg-key.conf
echo "Name-Email: root@`hostname --fqdn`" >> /var/local/oab/gpg-key.conf
echo "Expire-Date: 0" >> /var/local/oab/gpg-key.conf
cecho success

# Stop the system 'rngd'.
/etc/init.d/rng-tools stop >> "$log" 2>&1

ncecho " [x] Start generating entropy "
rngd -r /dev/urandom -p /tmp/rngd.pid >> "$log" 2>&1 &
pid=$!;progress $pid

ncecho " [x] Creating signing key "
gpg --homedir /var/local/oab/gpg --batch --gen-key /var/local/oab/gpg-key.conf >> "$log" 2>&1 &
pid=$!;progress $pid

ncecho " [x] Stop generating entropy "
kill -9 `cat /tmp/rngd.pid` >> "$log" 2>&1 &
pid=$!;progress $pid
rm /tmp/rngd.pid 2>/dev/null

# Start the system 'rngd'.
/etc/init.d/rng-tools start >> "$log" 2>&1
fi
fi

# Do we have signing keys, if so use them.
if [ -e /var/local/oab/gpg/pubring.gpg ] && [ -e /var/local/oab/gpg/secring.gpg ] && [ -e /var/local/oab/gpg/trustdb.gpg ]; then

# Sign the Release
ncecho " [x] Signing the 'Release' file "
rm /var/local/oab/deb/Release.gpg 2>/dev/null
Expand All @@ -395,8 +412,7 @@ if [ -e /var/local/oab/gpg/pubring.gpg ] && [ -e /var/local/oab/gpg/secring.gpg
ncecho " [x] Adding public key "
apt-key add /var/local/oab/deb/pubkey.asc >> "$log" 2>&1 &
pid=$!;progress $pid
fi

fi

# Update apt cache
echo "deb file:///var/local/oab/deb /" > /etc/apt/sources.list.d/oab.list
Expand Down

0 comments on commit 1f84a69

Please sign in to comment.