Bitbull Tech Notes - home of free minds ...

Kickstart Ubuntu 16.04 from Grub2

  • Create accessible WebDir on Webserver
    Name: setup1
    Dir: /var/www/html/inst/grub-kickstart/
cd /var/www/html/inst/grub-kickstart/

wget -O - http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz > /var/www/html/inst/grub-kickstart/u1604.i386.initrd.gz
wget -O - http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux > /var/www/html/inst/grub-kickstart/u1604.i386.linux

vi grub.cfg 
------------
set timeout=3
menuentry 'Ubuntu 16.04 Workstation Kickstart' --class ubuntu --class gnu-linux --class gnu --class os {
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        linux /boot/u1604.i386.linux  ks=http://setup1.mybuehl.ch/inst/ks/u1604-i386-kde-workstation.ks
        initrd /boot/u1604.i386.initrd.gz
}
------------

vi install.sh 
------------
#!/bin/bash

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

ls /boot/grub.cfg.bak || cp -av /boot/grub.cfg /boot/grub.cfg.bak

wget http://setup1/inst/grub-kickstart/u1604.i386.initrd.gz -O /boot/u1604.i386.initrd.gz
wget http://setup1/inst/grub-kickstart/u1604.i386.linux -O /boot/u1604.i386.linux
wget http://setup1/inst/grub-kickstart/grub.cfg -O /boot/grub/grub.cfg

sync
sleep 1
reboot -f
------------

Now you can kickstart as you like.

wget -O - http://setup1/inst/grub-kickstart/install.sh | bash

 

 

Create .deb packages for oracle java

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 ------
Home