Knoppix remaster

Script Download

#! /bin/sh
#----------------------------------------------------------------------
# kn-remaster (V 0.3-12)
# Description: remaster Knoppix using HD installation
# Author: Werner P. Schulz <Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>
# Created at: Fri Mar 12 15:13:14 CET 2010
# License: This file is licensed under the GPL v3.
#----------------------------------------------------------------------
# Last change: Fr 11 Mär 2016 19:29:15 CET [wps]

#---------------------------------------------------------#
# At which position shall we copy the new ISO?            #
# for example: CISO="192.168.2.10:/home/myuser/isoimages" #
CISO=""                                                   #
#---------------------------------------------------------#

first_run() {
# new menu 'Rescue CD'
cp $USK/rescue.menu /etc/xdg/menus/applications-merged/
cp $USK/rescue.directory $USK/document.directory \
  /usr/share/desktop-directories/
cp $USK/rescue/* /home/knoppix/.local/share/applications/
ln -s /usr/bin/kn-what.sh /usr/bin/kn-what
cp $USK/bashrc /root/.bashrc
echo "done" >> /root/add.kn
}

fknrsc() {
$RSCMD /bin $OKR
$RSCMD /etc $OKR \
  --exclude=/etc/fstab --exclude=/etc/resolv.conf \
  --exclude=/etc/init.d/knoppix-autoconfig --exclude=/etc/X11/xorg.conf \
  --exclude=/etc/passw* --exclude=/etc/shado*
$RSCMD /home $OKR \
  --exclude=*/.ssh/* --exclude=*/.gnupg/* --exclude=*/.mozilla/* \
  --exclude=*/.mc/history --exclude=*/.thumbnails/* \
  --exclude=*/.cache/* --exclude=*/.local/share/Trash/* \
  --exclude=*/Downloads/* --exclude=*/.gvfs \
  --exclude=/home/knoppix/.local/share/applications/kn-remaster.desktop
$RSCMD /lib $OKR
[ -d /lib64 ] && $RSCMD /lib64 $OKR
[ -d /libx32 ] && $RSCMD /libx32 $OKR
$RSCMD /opt $OKR \
  --exclude=/opt/knx/*
$RSCMD /root $OKR \
  --exclude=/root/.ssh/* --exclude=/root/.gnupg/* --exclude=/root/add.kn \
  --exclude=/root/.mc/history
$RSCMD /sbin $OKR
[ -d /selinux ] && $RSCMD /selinux $OKR
$RSCMD /tftpboot $OKR
$RSCMD /var $OKR \
  --exclude=/var/log/* --exclude=/var/tmp/* --exclude=/var/backups/*.gz \
  --exclude=/var/cache/apt/archives/* --exclude=/var/cache/locate/* \
  --exclude=/var/lib/apt/lists/* --exclude=/var/run/* \
  --exclude=/var/lib/mlocate?
# all of '/usr/' in KNOPPIX7
$RSCMD /usr $OKR7 \
  --exclude=$USK/* --exclude=/usr/src/* \
  --exclude=/usr/sbin/kn-remaster.sh --exclude=/usr/share/kn-knoppix/*
}

fkncalcul2() {
progress "Calculate sizes" &
PGPID=$!
source $USK/kn_calcul2.sh
disown $PGPID; kill $PGPID
}

new_iso() {
cd $OKK
echo 
progress "Calculate sha1sum" &
PGPID=$!
find -type f -not -name sha1sums -not -name boot.cat -not -name isolinux.bin \
  -exec sha1sum '{}' \; > KNOPPIX/sha1sums
disown $PGPID; kill $PGPID; echo 
progress "Build ISO" &
PGPID=$!
genisoimage -quiet -l -r -J -V "KNOPPIX remastered" \
  -no-emul-boot -boot-load-size 4 -boot-info-table \
  -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
  -o /opt/knx/iso/$KF $OKK
disown $PGPID; kill $PGPID; echo 
cd /opt/knx/iso
progress "Calculate md5sum" &
PGPID=$!
md5sum $KF > $KF.md5 && touch -r $KF $KF.md5
disown $PGPID; kill $PGPID; echo 
}

progress() {
setterm -cursor off
echo ; echo -n "$1 $2- please wait ..."
while true
  do
    echo -n "."
    sleep 7
done && echo -n "..done"
setterm -cursor on
}

#----------------------------------------------------------------------
# Main funktions
#----------------------------------------------------------------------
fknprepare() {
# Prepare enviroment within HD Installation
TL="Prepare enviroment"
mount | grep -q "media/sr0" || mount /media/sr0
if ! [ -d /media/sr0/KNOPPIX ]; then
  HINT1="Sometimes you must unselect, then select the DVD within \
\n\Zb\Z1VirtualBox menu\ZB in case you work with VirtualBox. \
\nBegin with step \Zb'Prepare enviroment..'\ZB once more!"
  $DGCMD --title "$TL" --msgbox "\nIf Knoppix DVD can't be mounted \
\nplease mount it within pcmanfm-filemanager.\n\n$HINT1" 0 0
  exit 1
fi
K_VERS=$(cat /media/sr0/KNOPPIX/knoppix-version)
mkdir -p $OKK $OKR $OKR1 $OKR2 $OKR7
# is CD or DVD and which version
if [ $(du -s /media/sr0 | awk '{print $1}') -lt 800000 ]; then
  WREM="CD"; echo "CD" > /root/add.kn
else
  WREM="DVD"; echo "DVD" > /root/add.kn
fi
$DGCMD --title "$TL" --defaultno --yesno \
  "\nWe will try to remaster KNOPPIX_V$K_VERS$WREM.\n\nShall wo go on?" 0 0
  if ! [ $? = 0 ]; then
    exit
  fi
if [ -e /media/sr0/KNOPPIX/add.kn ]; then
  $DGCMD --title "$TL" --msgbox "\nYou cannot use an already \
\nremastered Knoppix $WREM" 0 0
  exit 1
fi
if [ "$(cat /root/add.kn | grep done)" = "" ]; then
  first_run
fi
[ -x xscreensaver ] && su knoppix -c "xscreensaver-command -exit"
START=$(date +'%s')
# save bonus part of Knoppix - we will not remaster it
cp -a /media/sr0/KNOPPIX/KNOPPIX1 /$OKR1/
cp -a /media/sr0/KNOPPIX/KNOPPIX2 /$OKR2/
rsync -a --exclude="KNOPPIX/KNOPPIX*" /media/sr0/* $OKK/
# gunzip Initial RAM-disk
mkdir /opt/knx/minirt_rd /opt/knx/iso
cd /opt/knx/minirt_rd/
zcat $OKK/boot/isolinux/minirt.gz | cpio -imd --no-absolute-filenames
# setup loop-device to receive Filesystem-Image
if [ -d $OKK/loop ];then
  umount $OKK/loop
  losetup -d /dev/cloop0
  rm -R $OKK/loop
fi
mkdir $OKK/loop
# copy all of Filesystem-Image read- and writeable
losetup /dev/cloop0 /media/sr0/KNOPPIX/KNOPPIX
mount -t iso9660 /dev/cloop0 $OKK/loop
clear
progress "Decompress Filesystem-Image" &
PGPID=$!
rsync -a --exclude=*/.gvfs $OKK/loop/* $OKR/
disown $PGPID; kill $PGPID; echo 
umount $OKK/loop
losetup -d /dev/cloop0
rm -R $OKK/loop
umount /media/sr0
# all of /usr in KNOPPIX7
mv $OKR/usr/ $OKR7
# needed for new Syslinux Boot-menu
mkdir $USK/save
mv $OKK/boot/isolinux/isolinux.cfg $USK/save
cp $USK/slx/* /usr/lib/syslinux/modules/bios/vesamenu.c32 \
  $OKK/boot/isolinux/
K_VER=$(sed -ne'3p' $OKK/boot/isolinux/boot.msg \
  | awk '{print $1, $2}')
sed -i '7i\echo "K_VER TEXT_WEG"' \
  $OKR/etc/init.d/knoppix-autoconfig
sed -i "s/K_VER/$K_VER/" $OKR/etc/init.d/knoppix-autoconfig
chown -R knoppix:knoppix /home/knoppix/
[ -x xscreensaver ] && su knoppix -c "xscreensaver -nosplash &"
TT="\nFinished 'Prepare enviroment'! \
\nUsed time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
and $(expr $(expr $(date +'%s') - $START) % 60) sec."
$DGCMD --title "$TL" --msgbox "$TT\n\nYou can find the remaster enviroment \
\nwithin the directory '/opt/knx'." 0 0
}

#----------------------------------------------------------------------
fknrsync() {
# RSync with modifications of HD Installation
TL="Rsync modifications"
[ -x xscreensaver ] && su knoppix -c "xscreensaver-command -exit" > /dev/null
START=$(date +'%s')
[ -e /tmp/rsync.log ] && rm /tmp/rsync.log
progress "Rsync modifications" &
PGPID=$!
fknrsc
disown $PGPID; kill $PGPID; echo 
K_VER=$(uname -r)
# Kernel 64 or 32
[ -e $OKK/boot/isolinux/knoppix.menu ] && rm $OKK/boot/isolinux/knoppix.menu
if ! [ -e $OKK/boot/isolinux/linux64 ]; then
  [ -e /boot/vmlinuz-$K_VER-64 ] && \
    cp /boot/vmlinuz-$K_VER-64 $OKK/boot/isolinux/linux64
fi 
if [ -e $OKK/boot/isolinux/linux64 ]; then
  cp $USK/knoppix64.menu $OKK/boot/isolinux/knoppix.menu
else
  cp $USK/knoppix32.menu $OKK/boot/isolinux/knoppix.menu
fi
mkdir -p $OKR/var/cache/apt/archives/partial $OKR/var/lib/apt/lists/partial
[ -x xscreensaver ] && su knoppix -c "xscreensaver -nosplash &"
TT="\nFinished 'Rsync with modifications'! \
\nUsed time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
and $(expr $(expr $(date +'%s') - $START) % 60) sec."
$DGCMD --title "$TL" --msgbox "$TT\n\nYou can find the synchronized filesystem \
\nwithin the directory '$OKR'." 0 0
}

#----------------------------------------------------------------------
fkncalcul() {
source $USK/kn_calcul.sh
}

#----------------------------------------------------------------------
fknfinal() {
# Build new ISO from remastered Knoppix
TL="Build new ISO"
# check whether there is enough space for a new ISO on
if [ "$(cat /root/add.kn | grep CD)" = "CD" ]; then
  WREM=CD
  M_FREE=1800000
else
  WREM=DVD
  M_FREE=8500000
fi
N_FREE="$(du -s $OKK | awk '{print $1}')"
MIN_FREE=`echo "$M_FREE - $N_FREE" | bc`
HD_FREE=$(df / | tail -n1 | awk '{print $4}')
if [ $MIN_FREE -ge $HD_FREE ]; then
  $DGCMD --title "$TL" --msgbox "\nNot enough free space to build a \
\nnew $WREM-ISO! Make some removals in\nthe directory '/opt/knx/iso'" 0 0
  exit 1
fi
[ -x xscreensaver ] && su knoppix -c "xscreensaver-command -exit"
START=$(date +'%s')
# insert datetime-item
RM_VERSION=$(date "+%y%m%d-%H%M")
KF="kn-knoppix_$RM_VERSION.iso"
TEXT_WEG=$(sed -ne'7p' $OKR/etc/init.d/knoppix-autoconfig | awk '{print $4}')
sed -i "s/$TEXT_WEG/($RM_VERSION)\"/" $OKR/etc/init.d/knoppix-autoconfig
TEXT_WEG1=$(sed -ne'1p' $OKK/boot/isolinux/graphics.conf \
  | awk '{print $3 " " $4 " " $5}')
K_VER=$(sed -ne'3p' $OKK/boot/isolinux/boot.msg \
  | awk '{print $1, $2}')
sed -i "s/$TEXT_WEG1/$K_VER ($RM_VERSION)/" \
  $OKK/boot/isolinux/graphics.conf
$DGINFO --title "$TL" --infobox "\nStart creation of \Zb$KF\ZB." 0 0
# build new Initial RAM-disk
cd /opt/knx/minirt_rd
find . | cpio -oH newc | gzip -9 > $OKK/boot/isolinux/minirt.gz 

# build 1st new Filesystem-Image
clear; echo 
[ -e /opt/knx/knoppix_tmp ] && rm /opt/knx/knoppix_tmp
[ -e $OKK/KNOPPIX/KNOPPIX ] && rm $OKK/KNOPPIX/KNOPPIX
progress "Compress KNOPPIX" &
PGPID=$!
genisoimage -quiet -R -V KNOPPIX_FS -cache-inodes -hide-rr-moved -quiet \
  $OKR | create_compressed_fs -B 131072 -L 9 -q \
  -f /opt/knx/knoppix_tmp - $OKK/KNOPPIX/KNOPPIX 2> /dev/null
disown $PGPID; kill $PGPID; echo 

# build 2nd new Filesystem-Image
[ -e /opt/knx/knoppix_tmp ] && rm /opt/knx/knoppix_tmp
[ -e $OKK/KNOPPIX/KNOPPIX7 ] && rm $OKK/KNOPPIX/KNOPPIX7
progress "Compress KNOPPIX_1" &
PGPID=$!
genisoimage -quiet -R -V KNOPPIX_FS1 -cache-inodes -hide-rr-moved -quiet \
  $OKR7 | create_compressed_fs -B 131072 -L 9 -q \
  -f /opt/knx/knoppix_tmp - $OKK/KNOPPIX/KNOPPIX7 2> /dev/null
disown $PGPID; kill $PGPID; echo 
# do not exceed size limit 4 GB
progress "Calculate KNOPPIX_1" &
PGPID=$!
SIZEKN1="$(du $OKK/KNOPPIX/KNOPPIX7 | awk '{print $1}')"
disown $PGPID; kill $PGPID
if [ $SIZEKN1 -ge 4194304 ]; then
  $DGCMD --title "$TL" --msgbox "\n$OKK/KNOPPIX/KNOPPIX7 exceeds \
\nthe size of 4 GB. You cannot use it \
\nto build new ISO with it." 0 0
  exit 1
fi
# build new ISO
cp /root/add.kn $OKK/KNOPPIX/
new_iso
# fkncalcul2 # not needed for remaster
# try to copy ISO
TT="\nFinished! Used time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
and $(expr $(expr $(date +'%s') - $START) % 60) sec."
if ! [ "$CISO" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
  "\nWe will try to copy the ISO to\n$CISO\nPerhaps your root password \
\nis needed.\n\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    scp /opt/knx/iso/$KF.md5 /opt/knx/iso/$KF $CISO
    HINT="\nThey had been copied to\n$CISO."
  fi
else
  HINT="\n\n'secure copy' wasn't possible. \
\nEither you didn't set the path for copy the ISO \
\nor there has been an error."
fi
$DGCMD --title "$TL" --msgbox "$TT\n\nYou can find $KF(.md5) \
\nin the directory '/opt/knx/iso'.$HINT" 0 0
[ -x xscreensaver ] && su knoppix -c "xscreensaver -nosplash &"
}

#----------------------------------------------------------------------
fknbootcd() {
# Knoppix Boot-CD for old BIOS"
TL="Boot-CD"
MIN_FREE=10000
HD_FREE=$(df / | tail -n1 | awk '{print $4}')
if [ $MIN_FREE -ge $HD_FREE ]; then
  $DGCMD --title "$TL" --msgbox "\nNot enough free space to build a \
\nnew ISO! Make some removals in\nthe directory '/iso'" 0 0
  exit 1
fi
RM_VERSION=$(date "+%y%m%d-%H%M")
KB=kn-bootcd_$RM_VERSION.iso
TEXT_WEG1=$(sed -ne'1p' $OKK/boot/isolinux/graphics.conf \
  | awk '{print $3 " " $4 " " $5}')
K_VER=$(sed -ne'3p' $OKK/boot/isolinux/boot.msg \
  | awk '{print $1, $2}')
sed -i "s/$TEXT_WEG1/Boot-CD $K_VER/" \
  $OKK/boot/isolinux/graphics.conf
# Kernel 64 or 32
[ -e $OKK/boot/isolinux/knoppix.menu ] && rm $OKK/boot/isolinux/knoppix.menu
if [ -e $OKK/boot/isolinux/linux64 ]; then
  cp /usr/share/kn-knoppix/knoppix64.menu \
    $OKK/boot/isolinux/knoppix.menu
else
  cp /usr/share/kn-knoppix/knoppix32.menu \
    $OKK/boot/isolinux/knoppix.menu
fi
# build new Initial RAM-disk and boot-ISO
cd /opt/knx/minirt_rd
find . | cpio -oH newc | gzip -9 > $OKK/boot/isolinux/minirt.gz 
[ -d /opt/knx/bootcd ] && rm -r /opt/knx/bootcd/
mkdir /opt/knx/bootcd
cp -R $OKK/boot/ /opt/knx/bootcd/
cd /opt/knx/bootcd
genisoimage -l -r -J -V "KNOPPIX BootCD" \
  -no-emul-boot -boot-load-size 4 -boot-info-table -quiet \
  -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
  -o /opt/knx/iso/$KB /opt/knx/bootcd
cd /opt/knx/iso
md5sum $KB > $KB.md5 && touch -r $KB $KB.md5
# try to copy ISO
if ! [ "$CISO" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
  "\nWe will try to copy the ISO to\n$CISO\nPerhaps your root password \
\nis needed.\n\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    scp /opt/knx/iso/$KB.md5 /opt/knx/iso/$KB $CISO
    HINT="\nThey had been copied to\n$CISO."
  fi
else
  HINT="\n\n'secure copy' wasn't possible. \
\nEither you didn't set the path for copy the ISO \
\nor there has been an error."
fi
$DGCMD --title "$TL" --msgbox "\nYou can find $KB(.md5) \
\nin the directory '/opt/knx/iso'.$HINT" 0 0
}

#----------------------------------------------------------------------
fknadd() {
source $USK/kn_add.sh
}

#----------------------------------------------------------------------
# Main
#----------------------------------------------------------------------
# can we use this script
DGCMD="dialog --aspect 12 --colors"
DGINFO="dialog --aspect 12 --colors --sleep 3"
RSCMD="rsync -a --delete --log-file=/tmp/rsync.log --quiet"
if [ "$(id -u)" != 0 ]; then
  $DGCMD --title "Error" --msgbox "\nYou must be root to use this script!" 0 0
  exit 1
fi
if [ -d /UNIONFS ]; then
  $DGCMD --title "Error" --msgbox "\nYou cannot use this script \
\nwithin a flash installation!" 0 0
  exit 1
fi
OKK=/opt/knx/knoppix
OKR=/opt/knx/remaster
OKR1=/opt/knx/remaster1
OKR2=/opt/knx/remaster2
OKR7=/opt/knx/remaster7
USK=/usr/share/kn-knoppix
# show main menu
W1="Prepare enviroment within HD Installation"
W2="Add some tools and other suggestions"
W3="RSync with modifications of HD Installation"
W4="Calculate size of new KNOPPIX and new ISO"
W5="Build new ISO from remastered Knoppix"
W6="Knoppix Boot-CD for old BIOS"
while true; do
  if [ -d $OKR ]; then # prepare done
    WAHL=`$DGCMD --menu "What to do?" 0 0 0 \
      "$W2" "" "$W3" "" "$W4" "" "$W5" "" "$W6" "" 3>&1 1>&2 2>&3`
  else
    WAHL=`$DGCMD --menu "What to do?" 0 0 0 \
      "$W1" "" "$W2" "" "$W3" "" "$W4" "" "$W5" "" "$W6" "" 3>&1 1>&2 2>&3`
  fi
  case "$WAHL" in
    $W1) fknprepare;;
    $W2) fknadd;;
    $W3) fknrsync;;
    $W4) fkncalcul;;
    $W5) fknfinal;;
    $W6) fknbootcd;;
    *) break
  esac
done

 Top

Additions

#----------------------------------------------------------------------
# kn-add.sh is part of the remaster-script
# kn-remaster.sh (V 0.3-12)
# Author: Werner P. Schulz <Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>
# License: This file is licensed under the GPL v3.
#----------------------------------------------------------------------
# Last change: Fr 11 Mär 2016 19:27:48 CET [wps]

fnadd_CD() {
if [ "$(cat /root/add.kn | grep add1)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nPurge: LibreOffice, GIMP, XSane and vim.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    aptitude purge libreoffice? gimp libgimp2.0 gimp-data xsane? \
    vim vim-common vim-tiny vim-runtime knoppix-install-extras
    echo "add1" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep update)" = "" ]; then
  aptitude purge evilwm larswm
  aptitude update
  echo "update" >> /root/add.kn
fi
if [ "$(cat /root/add.kn | grep add2)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nInstall: Geany Diffuse gnome-search-tool \
\ngnome-system-monitor gnome-nettool mlocate grsync ncdu \
\ntransmission gddrescue.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    aptitude purge ddrescue
    aptitude install geany diffuse transmission gnome-search-tool \
      gnome-system-monitor mlocate grsync ncdu info
    aptitude install -t testing gnome-nettool
    aptitude install -t testing gddresue
    cd $USK/rescue_add
    cp gnome-nettool.desktop ncdu.desktop info.desktop \
      gnome-system-monitor.desktop gddresue.desktop \
      grsync.desktop /home/knoppix/.local/share/applications/
    echo "add2" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep add3)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nInstall: xfce4-terminal instead of lxterminal.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    aptitude install xfce4-terminal
    update-alternatives --set x-terminal-emulator \
      /usr/bin/xfce4-terminal.wrapper
    echo "add3" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep add4)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nInstall: Kernel64.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    K_VER=$(uname -r)
    aptitude show linux-headers-$K_VER-64 | egrep '(Package|Paket|Maintainer|Verwalter)'
    echo 
    aptitude install linux-headers-$K_VER-64
    echo 
    aptitude show linux-image-$K_VER-64 | egrep '(Package|Paket|Maintainer|Verwalter)'
    echo 
    aptitude install linux-image-$K_VER-64
    echo "add4" >> /root/add.kn
  fi
fi
}

fnadd_DVD() {
if [ "$(cat /root/add.kn | grep update)" = "" ]; then
  aptitude -y purge evilwm
  aptitude update
  echo "update" >> /root/add.kn
fi
if [ "$(cat /root/add.kn | grep add2)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nInstall: Diffuse mlocate ncdu gddrescue. \
\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    aptitude install diffuse mlocate ncdu
    cd $USK/rescue_add
    cp gnome-nettool.desktop ncdu.desktop info.desktop \
      gnome-system-monitor.desktop gddresue.desktop \
      grsync.desktop /home/knoppix/.local/share/applications/
    echo "add2" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep add3)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nInstall: xfce4-terminal instead of lxterminal.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    aptitude install xfce4-terminal
    update-alternatives --set x-terminal-emulator \
      /usr/bin/xfce4-terminal.wrapper
    echo "add3" >> /root/add.kn
  fi
fi
$DGCMD --title "$TL" --msgbox \
  "\nIf you don't purge either the graphic tools \
\nBlender or  FreeCad or the 'KDE desktop enviroment' \
\nor many of the other big tools you cannot remaster the DVD!\
\n\nUse 'Calculate size ..' to see if KNOPPIX7 will exceed \
\nthe size of 4 GB." 0 0
if [ "$(cat /root/add.kn | grep add6)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
	"\nPerhaps you don't need the KDE desktop environment. \
\n\nPurge: all of KDE.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    apt-get purge kde-*
    apt-get autoremove
    echo "add6" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep add7)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nPurge: all of Blender.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    rm /usr/bin/blender /usr/bin/blenderplayer \
    /usr/share/applications/blender.desktop
    rm -r /usr/share/blender/
    echo "add7" >> /root/add.kn
  fi
fi
if [ "$(cat /root/add.kn | grep add8)" = "" ]; then
  $DGCMD --title "$TL" --defaultno --yesno \
    "\nPurge: all of FreeCAD.\nShall wo go on?" 0 0
  if [ $? = 0 ]; then
    rm /usr/bin/freecad /usr/share/applications/freecad.desktop
    rm -r /usr/lib/freecad/
    echo "add8" >> /root/add.kn
  fi
fi
}

# remaster CD or DVD
TL="Suggestions"
if [ "$(cat /root/add.kn | grep CD)" = "CD" ]; then
  fnadd_CD
else
  fnadd_DVD
fi
$DGCMD --title "$TL" --msgbox "\nNothing else to do!" 0 0
chown -R knoppix:knoppix /home/knoppix/

 Top

Calculation

#----------------------------------------------------------------------
# kn-calcul.sh is part of the remaster-script
# kn-remaster.sh (V 0.3-12)
# Author: Werner P. Schulz <Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>
# License: This file is licensed under the GPL v3.
#----------------------------------------------------------------------
# Last change: Fr 11 Mär 2016 19:28:12 CET [wps]

calculate() {
# measured values by 'fkncalcul2()'
FAKT_CD=38.9
FAKT_CD1=38.2
OVER_CD=9100000
FAKT_DVD=35.3 # 30.6
FAKT_DVD1=44.5 # 43.1
OVER_DVD=32173410 # 28900000
# values after 'rsync'
S_REM="$(du -sb $UFS | awk '{print $1}')"
S_REM1="$(du -sb /usr | awk '{print $1}')"
	echo 
	echo "$UFS /usr: $S_REM   $S_REM1"
# new KNOPPIX(7) size and ISO size
if [ "$(cat /root/add.kn | grep CD)" = "CD" ]; then
  CFS_NEW=`echo "$S_REM *$FAKT_CD /100" | bc`
  CFS_NEW1=`echo "$S_REM1 *$FAKT_CD1 /100" | bc`
	echo "Calculated values"
	echo "of compressed fs: $CFS_NEW   $CFS_NEW1"
  CFS_NEW12=`echo "$CFS_NEW + $CFS_NEW1" | bc`
	echo "of total compressed fs: $CFS_NEW12"
  ISO_NEW=`echo "$CFS_NEW12 + $OVER_CD" | bc`
	echo "of total ISO: $ISO_NEW"
  NEW_CFS=`echo "$CFS_NEW /1024 /1024" | bc`
  NEW_CFS1=`echo "$CFS_NEW1 /1024 /1024" | bc`
	echo "Values human readable"
	echo "of compressed fs: $NEW_CFS   $NEW_CFS1"
  NEW_ISO=`echo "$ISO_NEW /1024 /1024" | bc`
	echo "of ISO: $NEW_ISO"
  if [ $NEW_ISO -ge 700 ]; then
    HINT1="The ISO exceeds the capactiy of a CD with 700 MB."
  else
    HINT1="The ISO may fit on a CD of 700 MB."
  fi
else
  CFS_NEW=`echo "$S_REM *$FAKT_DVD /100" | bc`
  CFS_NEW1=`echo "$S_REM1 *$FAKT_DVD1 /100" | bc`
	echo "Calculated values"
	echo "of compressed fs: $CFS_NEW   $CFS_NEW1"
  CFS_NEW12=`echo "$CFS_NEW + $CFS_NEW1" | bc`
	echo "of total compressed fs: $CFS_NEW12"
  ISO_NEW=`echo "$CFS_NEW12 + $OVER_DVD" | bc`
	echo "of total ISO: $ISO_NEW"
  NEW_CFS=`echo "$CFS_NEW /1024 /1024" | bc`
  NEW_CFS1=`echo "$CFS_NEW1 /1024 /1024" | bc`
	echo "Values human readable"
	echo "of compressed fs: $NEW_CFS   $NEW_CFS1"
  if [ $NEW_CFS1 -ge 4000 ]; then
    HINT1="The compressed filesystem KNOPPIX7 \
\nexceeds the size of 4000 MB."
  else
    HINT1="The compressed filesystem KNOPPIX7 does \
_\nnot exceed the size of 4000 MB."
  fi
		# Umrechnung in GB
  NEW_ISO=`echo "$ISO_NEW /1024 /1024" | bc`
	echo "of ISO: $NEW_ISO"
  if [ $NEW_ISO -ge 4812 ]; then
    HINT1="The ISO exceeds the capactiy of a DVD with 4.7 GB."
  else
    HINT1="The ISO may fit on a DVD of 4.7 GB."
  fi
fi
}

# calculate size of new compressed filesystem KNOPPIX(7) and new ISO
TL="Calculate"
# uncompressed filesystem
UFS=/opt/knx/remaster
# compressed filesystem
#CFS=$OKK/KNOPPIX/KNOPPIX
#CFS1=$OKK/KNOPPIX/KNOPPIX7
#BISO=/opt/knx/iso/$KF
$DGCMD --title "$TL" --infobox "\nCalculate approximate sizes" 0 0
START=$(date +'%s')
progress "Calculate sizes" &
PGPID=$!
calculate
disown $PGPID; kill $PGPID
HINT="Calculated size of compressed filesystem \
\nKNOPPIX: $NEW_CFS MB, \nKNOPPIX7: $NEW_CFS1 MB \
\nand for the whole new ISO: $NEW_ISO MB"
TT="\nFinished! Used time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
and $(expr $(expr $(date +'%s') - $START) % 60) sec."
$DGCMD --title "$TL" --msgbox "$TT\n\n$HINT\n\n$HINT1" 0 0

 Top

Calculation 2

#----------------------------------------------------------------------
# kn-add.sh is part of the remaster-script
# kn-remaster.sh (V 0.3-12)
# Author: Werner P. Schulz <Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!>
# License: This file is licensed under the GPL v3.
#----------------------------------------------------------------------
# Last change: Fr 11 Mär 2016 17:12:18 CET [wps]

calcul_1() {
echo "Calculate Grml"
}

calcul_2() {
# some calculations using values from final ISO
	echo 
S_REM="$(du -sb $UFS | awk '{print $1}')"
S_REM1="$(du -sb /usr | awk '{print $1}')"
	echo "$UFS(1): $S_REM   $S_REM1"
S_SQFS="$(du -sb $CFS | awk '{print $1}')"
S_SQFS1="$(du -sb $CFS1 | awk '{print $1}')"
	echo "$CFS(1): $S_SQFS   $S_SQFS1"
FAKTOR=`echo "scale=4; $S_SQFS *100 / $S_REM" | bc`
FAKTOR1=`echo "scale=4; $S_SQFS1 *100 / $S_REM1" | bc`
	echo "Faktor(1): $FAKTOR   $FAKTOR1"
# size of the ISO
S_ISO="$(du -sb $BISO | awk '{print $1}')"
# all of ISO without KNOPPIX(1)
OVER=`echo "$S_ISO - $S_SQFS - $S_SQFS1" | bc`
	echo "ISO and overhead: $S_ISO   $OVER"
CFS_NEW=`echo "($S_REM *$FAKTOR) /100" | bc`
CFS_NEW1=`echo "($S_REM1 *$FAKTOR1) /100" | bc`
	echo 
	echo "Calculated values"
	echo "of compressed fs: $CFS_NEW   $CFS_NEW1"
CFS_NEW12=`echo "$CFS_NEW + $CFS_NEW1" | bc`
ISO_NEW=`echo "$CFS_NEW12 + $OVER" | bc`
	echo "of total compressed fs and ISO: $CFS_NEW12   $ISO_NEW"
NEW_CFS=`echo "$CFS_NEW /1024 /1024" | bc`
NEW_CFS1=`echo "$CFS_NEW1 /1024 /1024" | bc`
	echo 
	echo "Values human readable"
	echo "of compressed fs: $NEW_CFS   $NEW_CFS1"
NEW_ISO=`echo "$ISO_NEW /1024 /1024" | bc`
	echo "of ISO: $NEW_ISO"
	echo 
echo "Overhead gemessen: $OVER"
echo "Faktor: $FAKTOR und Faktor1: $FAKTOR1"
echo "ISO-Groesse gemessen: $S_ISO"
echo "und berechnet: $ISO_NEW ($NEW_ISO)"
}

# uncompressed filesystem
UFS=/opt/knx/remaster
# compressed filesystem
CFS=$OKK/KNOPPIX/KNOPPIX
CFS1=$OKK/KNOPPIX/KNOPPIX7
BISO=/opt/knx/iso/$KF
calcul_2

 Top