Hi all,

last days I found that pretty well Linux Distribution KNOPPIX and I must say: NICE WORK!

After some testing, I decided to try to remaster the CD to my own needs.
First tries failed

But after reading some docs it works fine.

Now, I am writing some remastering tools. One of the first tools is fs-reengine, written in php, running in the command-shell with php-cgi!

You can download the tool at http://linuxcracks.bravehost.com/fs-reengine.png

What is fs-reengine?
fs-reengine is a tool, which scans the filesystem at the given entry point and renames/relinks/remasters the filesystem-contents (files/links/dirs), based on a list of replacements-2-make.

Why do I need fs-reengine?
I don't know! But I use it to mass-reconfigure the KNOPPIX configuration files and directory names to remaster the CD

How to use the tool?
First of all you should have the KNOPPIX-CD booted (I used Version 3.3), in runlevel 2. Therefore you have to type knoppix 2 at the boot prompt (when you can see the KNOPPIX boot-screen).

STARTING FROM SCRATCH

After KNOPPIX has finished its booting process to runlevel 2, you'll need a harddisk with at least 5 GB of free space.

I recommend, that you have created a partitition with 5 or more GB of free space and formatted it with an EXT3 filesystem. So let's call this partition /dev/hda5 for our example (maybe your device name depends).

Any of the following commands you should type is highlighted blue. (Beware! Change the /dev/hda5 and /mnt/hda5 to your needs!)

Lets create the mount point, mount our harddisk and create the directories we need:

root@KNOPPIX# touch /mnt/hda5
root@KNOPPIX# mount /dev/hda5 /mnt/hda5
root@KNOPPIX# cd /mnt/hda5
root@KNOPPIX# mkdir /knx
root@KNOPPIX# mkdir /knx/master
root@KNOPPIX# mkdir /knx/source
root@KNOPPIX# mkdir /knx/iso

Now, we have to copy the data in the /cdrom directory:

root@KNOPPIX# cp -av /cdrom/* /mnt/hda5/knx/master

Take a beer and relax, this may take a while

After that we have to copy the root-fs itself:

root@KNOPPIX# cp -av /KNOPPIX /mnt/hda5/knx/source

Take a bigger beer, this will take some time, too

Its a good choice, to make your Internet-Connection work now!

However, change to the source/KNOPPIX directory and make it chrooted, and don't forget to mount the proc fs :

root@KNOPPIX# cd /mnt/hda5/knx/source/KNOPPIX
root@KNOPPIX# chroot .
root@KNOPPIX# mount -t proc /proc proc

Let's make the internet work for our chrooted environment:

root@KNOPPIX# echo "nameserver 145.253.2.203" >/etc/resolv.conf

...little test...

root@KNOPPIX# ping denic.de -c 4

...a positive response is recommended here...

Lets get some updates and a little "workaround" for our fs-reengine tool.

root@KNOPPIX# apt-get update
...
root@KNOPPIX# apt-get install php4-cgi

...if this fails, read the remastering howtos first...

root@KNOPPIX# ln -s /usr/bin/php4 /usr/bin/php

Now a hard part....you have to edit /etc/php4/cgi/php.ini and set a part to the following values:

Code:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 86400     ; Maximum execution time of each script, in seco
memory_limit = 64M      ; Maximum amount of memory a script may consume (8MB)
We grab our dirtly little helper now:

root@KNOPPIX# cd /root
root@KNOPPIX# wget http://linuxcracks.bravehost.com/fs-reengine.png
root@KNOPPIX# mv -f fs-reengine.png fs-reengine.tgz
root@KNOPPIX# tar -xvzf fs-reengine.tgz
root@KNOPPIX# cd Helpers

Now enter...

root@KNOPPIX# ./fs-reengine --help

...this should print something like...

Code:
FileSystem - Re-engineerer V1.2 - written by -=PRoCesSkIlL=-

Usage: ./fs-reengine /absolutePath [options...] [extra-options...]

Available options are:

--write-logs                            => Write Logfiles to /tmp
--rebuild-files                         => Rebuild the contents of files
--rename-files                          => Rename regular files
--re-link                               => Rename / Change target of links
--rename-dirs                           => Rename directories
--all-options                           => Use all listed options above

Available extra-options are:

--translation-file "/fileName"          => Use a specified translation file
--reverse-order                         => Use the translation in reverse order
--exclude-names "/fil1;/fil2;/dir1..."  => Exclude the given files/links/dirs (Semicolon seperated)

Other commands:

--help                                  => Show this help context

Written by -=PrOCesSkIlL=-
To re-order your filesystem, edit the file /root/Helpers/translation.cfg to your own needs. Structure is:

OLDNAME ~~ NEWNAME

an example file is attached!

If you want to convert the hole filesystem of KNOPPIX enter something like:

root@KNOPPIX# /root/Helpers/fs-reengine / --all-options --exclude-names "/var/lib/dpkg;/var/lib/apt"

(...may take about 2 hours or more, depending on your system...)

Be sure that you have entered: exclude-names "/var/lib/dpkg;/var/lib/apt" this tag, or dpkg and apt could fail after remastering.

Your filesystem is remastered now At this point follow the instructions of the remastering how-to.

Feel free to play around