Live-CD remastering
Knoppix Live-CD remastering
At present time this software is a beta-testing.
Description
This software for CD remastering is include a lot of DEB-packages (elphel-specific and dependenced), files and scripts. All software is compressed to the .tar.bz2 archive (package size is approx. 26 Mb).
There are two scripts for remastering.
First script (make.sh) is general and started by user. Source code:
# Make a clone from existed knoppix live-cd
echo "Welcome to KNOPPIX-to-ELPHIX remastering program"
part=0
query() {
    echo -n "$1 [$2] " >&2
    read answer
    if [ -z $answer ] ; then answer=$2 ; fi
}
# The work directories specifing
echo "Stage 1. Now you can specify the work directories and other parameters"
if [ part=0 ]
then
query "Please, specify the work partition. For example, hda1" hda1
part=$answer
fi
version=`cat debs/version.txt`
home=/home/knoppix/LiveCD-$version
source0=/dev/$part
dest0=/mnt/$part
source=$dest0/knxsource
dest=$dest0/knxmaster
echo "Mounting the work partition..."
mount $source0 $dest0
echo "Done"
echo "Creating the work directories..."
mkdir -p $source/KNOPPIX
mkdir -p $dest/KNOPPIX
echo "Done"
echo "Stage 1 is finished without errors"
# The next step - copying files and directories
echo "Stage 2. Copying necessary files and directories, preparing the internet connection"
# Copying the KNOPPIX directory
echo "Copying the KNOPPIX directory. This can take a few minutes. Please, wait..."
cp -Rp /KNOPPIX/* $source/KNOPPIX
cd /cdrom; find . -size -10000k -type f -exec cp -p --parents '{}' $dest/ \;
echo "Done"
# Preparing the internet connection
echo "Preparing the internet connection"
mv $source/KNOPPIX/etc/dhcpc/resolv.conf $source/KNOPPIX/etc/dhcpc/resolv.conf.orig
cp /etc/dhcpc/resolv.conf $source/KNOPPIX/etc/dhcpc/resolv.conf
echo "Done"
echo "Stage 2 is finished without errors"
# Removing packages
echo "Stage 3. Removing old packages and files. This can take a few minutes. Please, wait..."
mkdir -p $source/KNOPPIX/debs
cp -Rp $home/debs/* $source/KNOPPIX/debs
mkdir -p $source/KNOPPIX/patches
cp -Rp $home/patches/* $source/KNOPPIX/patches
cp $home/inst-rem.sh $source/KNOPPIX/inst-rem.sh
rm -f $source/KNOPPIX/usr/share/apps/ksplash/Themes/Default/splash_bottom.png
rm -f $source/KNOPPIX/usr/share/apps/ksplash/Themes/Default/splash_top.png
rm -f $source/KNOPPIX/usr/local/lib/knoppix.jpg
cp -Rp $home/images/* $source/KNOPPIX
echo "Done"
echo "Stage 3 is finished without errors"
# Installing packages
echo "Stage 4. Installing the ELPHIX specific packages and patches. This can take a few minutes. Please, wait..."
chroot $source/KNOPPIX sh inst-rem.sh
rm -rf $source/KNOPPIX/debs
rm -rf $source/KNOPPIX/patches
rm -rf $source/KNOPPIX/inst-rem.sh
echo "Done"
echo "Stage 4 is finished without errors"
# Fixing the known Knoppix bugs
echo "Stage 5. Fixing the known Knoppix bugs"
# Fixing the USB-2.0 bug
echo "Fixing the USB-2.0 bug in the linuxrc"
cp $dest/boot/isolinux/minirt.gz $dest0
cd $dest0
gunzip minirt.gz
mkdir -p MRT
mount -o loop minirt MRT
cd MRT
patch < $home/patches/linuxrc.patch
cd $dest0
umount MRT
gzip minirt
mv minirt.gz $dest/boot/isolinux/minirt.gz
cd $home
echo "Done"
echo "Stage 5 is finished without errors"
# Copying the sources and files
echo "Stage 6. Copying the sources and files, cleaning the filesystem"
cp -Rp $home/files/* $dest
echo "Done"
# Removing the temporary files and cleaning the filesystem
echo "Removing the temporary files and cleaning the filesystem"
rm $source/KNOPPIX/etc/dhcpc/resolv.conf
mv $source/KNOPPIX/etc/dhcpc/resolv.conf.orig $source/KNOPPIX/etc/dhcpc/resolv.conf
rm -rf $source/KNOPPIX/.rr_moved
rm -rf $source/KNOPPIX/etc/bacula
rm -rf $source/KNOPPIX/var/lib/bacula
rm -rf $source/KNOPPIX/etc/brltty
rm -rf $source/KNOPPIX/var/games
rm -rf $source/KNOPPIX/usr/share/emacs21
rm -rf $source/KNOPPIX/usr/share/games/frozen-bubble
rm -rf $source/KNOPPIX/usr/share/fonts/wine
rm -rf $dest0/MRT
echo "Done"
echo "Stage 6 is finished without errors"
# Creating the ISO-file KNOPPIX
echo "Stage 7. Creating the ELPHIX compressed image. This can take a few minutes or hours. You can drink coffee, read the book, sleep etc. In any case, please, wait..."
mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "Elphel,Inc. www.elphel.com" -hide-rr-moved -cache-inodes -no-bak -pad $source/KNOPPIX | nice -5 /usr/bin/create_compressed_fs -b - 65536 > $dest/KNOPPIX/KNOPPIX
echo "Done"
# Creating the ISO-image LiveCD Knoppix
echo "Creating the ISO-image LiveCD ELPHIX. This can take a few minutes. Please, wait..."
cd $dest
mkisofs -pad -l -r -J -v -V "ELPHIX-$version" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o $dest0/ELPHIX-$version.iso $dest
echo "Done"
echo "Stage 7 is finished without errors"
echo "Congratulations! The remastering is finished. ELPHIX-$version is ready for burning. You can find the ISO-image of ELPHIX-$version on the $dest0 partition. Good luck!"
The second script (inst-rem.sh) is started by the first script automatically and used for removing/installing DEB-packages. Source code:
# Sub-script for removing and installing packages ping -c 5 google.com dpkg -P `cat /debs/remove-debs` rm -rf /etc/mozilla-firefox/profile/mimeTypes.rdf dpkg -i --force-overwrite /debs/depend/*.deb dpkg -i --force-overwrite /debs/*.deb cd /etc/X11/Xsession.d patch < /patches/45xsession.patch cd /etc/init.d patch < /patches/knoppix-autoconfig.patch cd /etc/skel/.kde/share/config patch < /patches/kdesktoprc.patch exit
System Requirements
You must have:
1. at least 1 GB of FREE RAM+Swap total (e.g. 256M ram, and 750M swap AVAILABLE)
2. 3 GB free on a Linux filesystem (ext2/3, xfs, etc.) formatted disk partition (you must unmount this partition before remastering)
3. Knoppix 4.0.2-2005-09-23 EN
Instruction
1. Download the LiveCD-1.4.3-beta1.tar.bz2 archive from SourceForge http://prdownloads.sourceforge.net/elphel/LiveCD-1.4.3-beta2.tar.bz2?download
2. Boot from the Knoppix CD
3. Unpack archive to the /home/knoppix directory
4. Open a root shell:
Menu: Kmenu->Knoppix->Root Shell
5. Type the following two commands:
cd /home/knoppix/LiveCD-1.4.3 sh make.sh
6. The remastering script will be started. You must specify the work partition (for example hda1). This partition will be used for remastering Knoppix.
NOTE: This partition MUST be unmounted!
7. Follow the appeared instructions
8. The ELPHIX-1.4.3.ISO image will be placed at the work partition
9. Use the special software (for example, K3B) for writing image to CD
 
	  