Skip to content
Browse files

Added support for Java6u31 when the upstream script tags it as stable…

…. Other fixes and improveents, closes #3, closes #4, closes #7 and closes #8.
  • Loading branch information...
1 parent e9a6a11 commit 1f84a69d8e5e24c7dc2765d333e1ef78b3adfe9a @flexiondotorg committed Feb 17, 2012
Showing with 113 additions and 59 deletions.
  1. +16 −0 CHANGES
  2. +0 −1 LICENSE
  3. +21 −2 README
  4. +4 −0 TODO
  5. +72 −56 oab-java6.sh
View
16 CHANGES
@@ -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
-----
View
1 LICENSE
@@ -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
View
23 README
@@ -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
@@ -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
-----
@@ -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
View
4 TODO
@@ -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.
View
128 oab-java6.sh
@@ -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}
@@ -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"
@@ -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
@@ -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
@@ -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
@@ -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

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...)

@flexiondotorg
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+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
@@ -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
@@ -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

0 comments on commit 1f84a69

Please sign in to comment.
Something went wrong with that request. Please try again.