Created
June 15, 2014 10:55
-
-
Save iwinux/250b864f519ac9876c5d to your computer and use it in GitHub Desktop.
build Oracle JDK deb package with fpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PACKAGE=oracle-jdk-7 | |
PACKAGE_VIRTUAL=oracle-jdk | |
VERSION_MAJOR=7 | |
VERSION_MINOR=60 | |
VERSION="${VERSION_MAJOR}u${VERSION_MINOR}" | |
BUILD=b19 | |
PKG_BASENAME="jdk-$VERSION-linux-x64.tar.gz" | |
URL="http://download.oracle.com/otn-pub/java/jdk/$VERSION-$BUILD/$PKG_BASENAME" | |
PREFIX=/usr/lib/jvm/jdk-$VERSION | |
DEBNAME_VIRTUAL="${PACKAGE_VIRTUAL}-${VERSION}_amd64.deb" | |
DEBNAME="${PACKAGE}-${VERSION}_amd64.deb" | |
mkdir -p work | |
if [[ ! -f "work/$PKG_BASENAME" ]] | |
then | |
echo "downloading from $URL" | |
# bypass manual LICENSE confirmation: http://bit.ly/1hUJBDC | |
# see also PKGBUILD from AUR: http://bit.ly/1n7VhYr | |
wget -c -O work/$PKG_BASENAME \ | |
--no-cookies \ | |
--header "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
$URL | |
fi | |
cd work | |
if [[ ! -f "$DEBNAME_VIRTUAL" ]] | |
then | |
echo "building $DEBNAME_VIRTUAL" | |
touch virtual | |
fpm -s dir -t deb -n $PACKAGE_VIRTUAL -v $VERSION -p $DEBNAME_VIRTUAL \ | |
--prefix $PREFIX \ | |
--depends $PACKAGE \ | |
--provides java-jdk \ | |
--provides java7-jdk \ | |
--provides java-runtime \ | |
--provides java7-runtime \ | |
--provides default-jre \ | |
--provides default-jre-headless \ | |
--provides java6-runtime-headless \ | |
--inputs virtual | |
fi | |
if [[ ! -f "$DEBNAME" ]] | |
then | |
echo "building $DEBNAME" | |
tar xzf $PKG_BASENAME | |
fpm -s dir -t deb -n $PACKAGE -v $VERSION -p $DEBNAME \ | |
--prefix $PREFIX \ | |
--conflicts openjdk-7-jdk \ | |
--conflicts openjdk-7-jre \ | |
--template-scripts \ | |
--after-install ../post-install.sh \ | |
--before-remove ../pre-remove.sh \ | |
-C "jdk1.${VERSION_MAJOR}.0_${VERSION_MINOR}" \ | |
. | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment