Skip to content

Instantly share code, notes, and snippets.

@notpeter
Created July 3, 2015 00:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save notpeter/9b0e20d0171fbd2c56ef to your computer and use it in GitHub Desktop.
Save notpeter/9b0e20d0171fbd2c56ef to your computer and use it in GitHub Desktop.
Oracle Java JDK - Make Debian/Ubuntu deb packages
#!/usr/bin/env bash
set -u
# Downloads Oracle JDK tarball and makes fancy debs out of it.
# Output is full of warnings, but the packages work. ;)
# Example URL='http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz'
MAJOR=8
MINOR=45
BUILD=14
REVISION=1 # Bump this for package revisions of the same JDK version (e.g. packaging error)
FILENAME="jdk-${MAJOR}u${MINOR}-linux-x64.tar.gz"
URL="http://download.oracle.com/otn-pub/java/jdk/${MAJOR}u${MINOR}-b${BUILD}/${FILENAME}"
wget --progress=dot:giga -O "${FILENAME}" --header 'Cookie: oraclelicense=accept-securebackup-cookie' ${URL}
# Requires java-package >= 0.59 (not in stable repos yet).
if (( $(echo "$(make-jpkg --version | awk -F' ' '{ print $2}') 0.59" | awk '{print ($1 >= $2)}') )); then
echo yes | make-jpkg --revision "${REVISION}" ${FILENAME}
else
echo "Need make-jpkg >= 0.59. To install:"
echo "wget http://http.us.debian.org/debian/pool/contrib/j/java-package/java-package_0.59_all.deb"
echo "sudo dpkg -i java-package_0.59_all.deb"
echo "sudo apt-get install -f"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment