1) Install needed Packages:
apt-get install build-essential checkinstall

 

1) Download OracleJRE:
mkdir -p /srv/devel/java
cd /srv/devel/java
http://www.java.com/de/download/
jre-xxx-linux-i586.tar.gz

2) check and modify this files:
*-pak
version.cfg
*.sh (install.sh for exception file generator)

3) create package with
bash create-deb.sh

4) done!

This is was you need to get it running:


vi create-deb.sh ###------ create this file ------
#!/bin/bash -e
# DESC: create debian package with checkinstall

. version.cfg

cd $DIR
rm -f backup* || true

apt-get remove --purge -y $NAME

checkinstall -D --backup --exclude=$DIR --fstrans=no --nodoc --pkgname $NAME --pkgversion $VERS --arch $ARCH --pkgrelease $REL --pkggroup $GRP --pkglicense "$LIC" --pkgsource "$SRC" --maintainer "$MAINT" --provides "$PROVIDES" --replaces="$REPLACES" --include $INCLUDE ./$INSTALL

rm -f backup* || true
### ------ end of file ------

vi deployment.properties ###------ create this file ------
deployment.security.level=MEDIUM
deployment.browser.path=/usr/bin/firefox
deployment.user.security.exception.sites=/usr/lib/oracle-java8-jre/lib/security/exception.sites
### ------ end of file ------
touch exception.sites

vi postinstall-pak ###------ create this file ------
#!/bin/sh
set -e

rm -f /usr/lib/mozilla/plugins/libnpjp2.so || true
rm -f /usr/lib/mozilla/plugins/*java* || true
update-alternatives --remove-all java || true
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/oracle-java8-jre/bin/java" 1
update-alternatives --remove-all javaws || true
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/oracle-java8-jre/bin/javaws" 1
update-alternatives --remove-all mozilla-javaplugin.so || true
update-alternatives --install "/usr/lib/mozilla/plugins/mozilla-javaplugin.so" "mozilla-javaplugin.so" "/usr/lib/oracle-java8-jre/lib/i386/libnpjp2.so" 1
### ------ end of file ------

vi postremove-pak ###------ create this file ------
#!/bin/sh
set -e
echo
### ------ end of file ------

vi preinstall-pak ###------ create this file ------
#!/bin/sh
set -e

rm -fr /usr/lib/oracle-java8-jre || true
### ------ end of file ------

vi preremove-pak ###------ create this file ------
#!/bin/sh
set -e

rm -f /usr/lib/mozilla/plugins/libnpjp2.so || true
rm -f /usr/lib/mozilla/plugins/*java* || true
update-alternatives --remove-all java || true
update-alternatives --remove-all javaws || true
update-alternatives --remove-all mozilla-javaplugin.so || true
### ------ end of file ------

vi version.cfg ###------ create this file ------
# ------ GERNERAL VARS ------
DIR=/srv/devel/java
NAME=oracle-java8-jre
VERS=1.8.45
REL=1
ARCH=i386
GRP=Crap
INSTALL=install.sh
INCLUDE=/usr/lib/oracle-java8-jre
PROVIDES='java-runtime, java2-runtime, java5-runtime, java6-runtime, sun-java6-bin, sun-java6-jre, sun-java6-plugin, java7-runtime, sun-java7-bin, sun-java7-jre, sun-java7-plugin'
REPLACES='oracle-java7-jre'
LIC='Oracle Binary Code License Agreement'
SRC='http://www.java.com/en/download/linux_manual.jsp'
MAINT="chris@bitbull.ch"

# ------ SETUP SPECIFIC VARS for $INSTALL ONLY ------
# JAVA PACKAGE
TGZ=jre-8u45-linux-i586.tar.gz
JRE_PROP_FILE=deployment.properties
JRE_EXCEPTION_FILE=exception.sites
### ------ end of file ------

vi install.sh ###------ create this file ------
#!/bin/bash

. version.cfg

cd $DIR
rm -rf /usr/lib/oracle-java*
rm -fr /usr/lib/jre*
rm -rf /etc/alternatives/*java*

tar -C /usr/lib -xzf $DIR/$TGZ

# create exception file
cat << EOF > $DIR/$JRE_EXCEPTION_FILE
https://server1.mysite.ch
https://javacrap.ch
https://printer-xy.ch
EOF

for D in /usr/lib/jre*/lib/
do
   cp $DIR/$JRE_PROP_FILE $D
   cp $DIR/$JRE_EXCEPTION_FILE $D/security/
done

cp -a /usr/lib/jre* /usr/lib/oracle-java8-jre
rm -fr /usr/lib/jre*

echo installation done
### ------ end of file ------

vi create-deb.sh ###------ create this file ------
#!/bin/bash -e
# DESC: create debian package with checkinstall

. version.cfg

cd $DIR
rm -f backup* || true

apt-get remove --purge -y $NAME

checkinstall -D --backup --exclude=$DIR --fstrans=no --nodoc --pkgname $NAME --pkgversion $VERS --arch $ARCH --pkgrelease $REL --pkggroup $GRP --pkglicense "$LIC" --pkgsource "$SRC" --maintainer "$MAINT" --provides "$PROVIDES" --replaces="$REPLACES" --include $INCLUDE ./$INSTALL

rm -f backup* || true
### ------ end of file ------