Quote Originally Posted by techfreak
Can some one write brief instructions on how to use this sort script for sorting so we can actually use it. In addition, where it syas "KNOPPIX.build" in the script, is that the location of your KNOPPIX chrooted environment ?.
Well no it isn't since they do not use chroot to remaster! You must actually boot into your remastering environment. Now I have not yet figured out the sorting scripts either and I also know that it is possible to use only one partition for remastering but I use 2. I am fully aware that there is still much room for improvement in this method. Also notice that I use Kanotix so adjust accordingly for Knoppix.

This is very easy to do and here's how I do it. (Thought about adding this to the wiki but the docs there get hosed up really quickly!!) Anyway........

#Substitue your own drives for /hda11 & /hda12 throughout.
#/hda11 will be the SOURCE direcotory- the directory we install Kanotix to.
#/hda11 is: 1 partition of 3G (or more if you want to make a dvd)
#/hda12 will be the BUILD directory containing the compressed KNOPPIX fs,
# boot.img & final image (kanotix.iso).
#/hda12 is: 1 partition of 1G (more if you're making a dvd).
_______________________________
#BOOT & INSTALL KANOTIX
sudo kanotix-installer
use /dev/hda11 for /
Select 'knoppix' type install!
edit .knofig to install grub to partition
(of course you can install to mbr if you don't wish to boot another OS)
______________________________
#SET UP BUILD DIRECTORY

mount /dev/hda12 /mnt/hda12
mkdir /mnt/hda12/KNOPPIX
cp /cdrom/KNOPPIX/boot.img /mnt/hda12/KNOPPIX

_______________________________
#EDIT YOUR BOOT LOADER
#EXAMPLE: /boot/grub/menu.lst entry

title remaster
root (hd0,10)
kernel /boot/vmlinuz root=/dev/hda11 ro ramdisk_size=100000 init=/etc/init lang=us apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi nomce quiet alsa mem=1015728K vga=791
savedefault
boot
__________________________________________________ _______________
#AND NOW THE MOMENT YOU'VE BEEN WAITING FOR.....
REBOOT INTO YOUR REMASTERING ENVIRONMENT>>>
Be sure to use:
desktop=twm
IF you intend on removing KDE and/or IceWM
or boot into run level 2
___________________________
DO KANOTIX YOUR WAY
su
install-keymap us
tar -czf skel.tar.gz skel
(save it somewhere else if you think you might need it)
rm -rf /etc/skel

______________________
#APT-GET INSTALL
apt-get install synaptic blah blah blah
________________________
TWEAK THE DESKTOP
#Your configurations are saved in /home/knoppix
#which eventually becomes /etc/skel
#When you are COMPLETELY FINISHED tweaking the desktop
su
mv /home/knoppix /etc/skel
touch /home/knoppix
chown knoppix:knoppix /home/knoppix
chown -R root:root /etc/skel
updatedb
ldconfig
update-modules
_____________________________________
REBOOT INTO YOUR PRIMARY OS
su
mount /dev/hda11 /source
chroot /source

Now you need to clean up. I have a customized version of a script I found somewhere (sorry I forget where) it's at the bottom (maybe by charan??)
ctrl+d (to leave chroot)
__________________________________________________ __________________________________________________ ______________________________________________
#MAKE THE COMPRESSED KNOPPIX FILE SYSTEM
cd /source
/source# mkisofs -RUV "KNOPPIX.net filesystem" -P "mzilikazix.org" -cache-inodes -no-bak -pad /hda11 | nice -5 create_compressed_fs - 65536 > /build/KNOPPIX/KNOPPIX
__________________________________________________ __________________________________________________ __________________________________________________ _________________________________
#SORT THE FILES

ls -U /build/KNOPPIX
boot.img KNOPPIX
cd /build
__________________________________________________ __________________________________________________ ________________
#MAKE THE ISO IMAGE

/build# mkisofs -l -r -J -V "KanotiXFCE4" -b KNOPPIX/boot.img -c KNOPPIX/boot.cat -o kanotixfce4.iso /build

Of course you must make adjustments for Knoppix!! Here's the script:

Code:
#!/bin/sh
umask 022

/etc/init.d/autofs stop

# remove only "temporary" or saved files in the given directories
nuke(){
for i in `find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 2>/dev/null`; do
rm -f "$i"
done
}

# set all files in the given directories to a length of zero
zero(){
for i in `find "$@" -type f -size +0 -not -name \*.ini 2>/dev/null`; do
:> "$i"
done
}

rmdir /mnt/cdrom?* /mnt/hd?* 2>/dev/null
rm -f /etc/X11/XF86Config /etc/X11/XF86Config-4 \
      /etc/XF86Config /etc/XF86Config-4 /etc/sysconfig/* \
      /etc/ssh/*key* \
      #added by [email protected]
      /home/knoppix/*
      /etc/samba/*.SID /etc/samba/*.tdb \
      /dev/mouse* /dev/cdrom* /dev/cdwriter* \
      /var/run/*/* /var/run/* /var/log/ksymoops/* /var/lock/*/* /var/lock/* \
      /var/state/*/* /var/state/* /var/log/nessus/* /var/lib/nessus/* \
      /halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \
      /etc/resolv.conf /etc/*passwd- /etc/*shadow- /etc/*group- 2>/dev/null
mkdir -p /etc/sysconfig/network-scripts /etc/sysconfig/provider
cat >/etc/dhcpc/resolv.conf <<EOT
# insert nameservers here
# nameserver 127.0.0.1
EOT
chmod 644 /etc/dhcpc/resolv.conf
ln -s /etc/dhcpc/resolv.conf /etc/
rm -rf /tmp/* /var/tmp/* /var/backups/* /.ssh /root/.ssh /home/*/.ssh \
       /root/.bash_history /home/*/.bash_history \
       /home/knoppix/* /home/knoppix/.??* /var/lib/texmf/ls-R \
       /var/spool/texmf/ls-R
nuke /var/log /var/cache
zero /var/local /var/log /var/spool \
     /var/lib/games /var/cache/man /var/lib/wine \
     /var/lib/nfs /var/lib/xkb

for i in `find /usr/*/man -name \*.\[0-9ln\]` ; do
[ -f "$i".gz -o -f "$i".bz2 ] && rm -f "$i"
done

#added by [email protected]
# delete dowloaded debian packages
echo -n "Removing .debs..."
apt-get clean
echo "	Done."

# Recreate /etc/resolv.conf
echo -n "Recreating /etc/resolv.conf..."
cat >/etc/resolv.conf <<EOT
# insert nameservers here
# nameserver 127.0.0.1
EOT
chmod 644 /etc/resolv.conf
echo "  Done."

# Recreate empty utmp and wtmp
:>/var/run/utmp
:>/var/run/wtmp
# regenerate module dependencies and ls.so.cache
echo -n "Updating ld.so.cache..."
ldconfig
echo "	Done."
echo -n "Updating modules.dep..."
depmod -a 2>/dev/null
echo "	Done."
echo -n "Updating texhash..."
mktexlsr
echo "	Done."
echo -n "Updating mandb..."
mandb -c
man doesnotexist >/dev/null 2>&1
echo "	Done."
echo -n "Updating menus..."
/usr/sbin/mkmenusfromkde
#added by [email protected]
echo -n "Updating Debian menus"
update-menus -v
echo "	Done."
echo -n "Updating locate-database..."
updatedb --prunepaths="/KNOPPIX.build /mnt/hd /mnt/cdrom /tmp /usr/tmp /var/tmp"
echo "	Done."

echo -n "Fixing permissions in /dev/..."
chown root.root /dev/ttyp*
chmod 666 /dev/ttyp* /dev/sg*
echo "  Done".
#added by [email protected]
#only enable this if you really know what you;re doing!!
#echo -n "Cleaning up orphans..."
#deborphan | xargs apt-get -y remove
#echo "  Done".

echo -n "Cleaning up config files..."
COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs dpkg -P
echo "  Done".

echo -n "Removing unused architecture Kernel sources: "
for i in `ls -1 /usr/src/linux/arch/ | grep -v i386`; do
	echo -n "$i "; rm -rf /usr/src/linux/arch/"$i" /usr/src/linux/include/asm-"$i"
done
So hopefully this thread is the start of a very complete and very easy remastering howto. The chroot method is ok if you just want to make some small changes but if you're not running the same kernel you have problems plus other unnecessary issues to deal with.

Of course you can just boot Knoppix, cd KNOPPIX and do cp -a * /mnt/point and then boot into it as well.