Skip to content

Instantly share code, notes, and snippets.

@rcrowley
Created April 12, 2012 00:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rcrowley/2363696 to your computer and use it in GitHub Desktop.
Save rcrowley/2363696 to your computer and use it in GitHub Desktop.
Oracle JDK Debian packaging
VERSION="6u31-b04"
BUILD="betable4"
set -e -x
# Keep track of the original working directory.
OLDESTPWD="$PWD"
# Work in a temporary directory.
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
# Download Oracle's JDK but really just copy it from the old working directory.
# <http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html>
JDK_BIN="jdk-$(echo "$VERSION" | cut -d"-" -f"1")-linux-x64.bin"
cp "$OLDESTPWD/$JDK_BIN" "."
#curl -sv -LO "http://download.oracle.com/otn-pub/java/jdk/$VERSION/jdk-$(echo "$VERSION" | cut -d"-" -f"1")-linux-x64.bin"
sh "$JDK_BIN"
# Pull out the good parts.
DIRNAME="jdk1.6.0_$(echo "$VERSION" | awk -F"[u-]" '{print $2}')"
mkdir -p "rootfs/usr/share/man"
mv "$DIRNAME/bin" "rootfs/usr"
mv "$DIRNAME/include" "rootfs/usr"
mv "$DIRNAME/jre" "rootfs/usr"
mv "$DIRNAME/lib" "rootfs/usr"
mv "$DIRNAME/man/man1" "rootfs/usr/share/man"
# FPM that bitch.
fakeroot fpm -C "rootfs" \
-d "ca-certificates" -d "libnss3-1d" -d "libstdc++6" -d "tzdata" \
-m "Richard Crowley <richard@betable.com>" \
-n "oracle-jdk" -v "$VERSION-$BUILD" \
-p "$OLDESTPWD/oracle-jdk_${VERSION}-${BUILD}_amd64.deb" \
--provides "java2-runtime" --provides "java2-runtime-headless" \
--provides "java5-runtime" --provides "java5-runtime-headless" \
--provides "java6-runtime" --provides "java6-runtime-headless" \
-s "dir" -t "deb" "usr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment