Hack 98 Automate Knoppix Remastering

 < Day Day Up > 

Hack 98 Automate Knoppix Remastering

figs/moderate.gif figs/hack98.gif

Automate the remastering process by using one of Klaus's scripts .

After you follow the steps in [Hack #94] a few times, you might think to yourself, "I type some of the same commands every time. I should put this in a script." A number of people have had the same thought, and you can find quite a few scripts floating around the Internet that help automate much of the process of remastering a Knoppix CD. Klaus and the other Knoppix maintainers don't type the commands in by hand either, and you can actually use the same scripts they use to automate the remastering process. These scripts not only create the compressed filesystem and CD image for you, but they also clean up your distribution, remove excess files, update manpages and locate databases, and perform other timesaving functions.

The first part of the process is the same as in [Hack #94] . Follow all of those steps in exactly the same way through the chroot process, and stop once you reach Section 9.2.4.

9.6.1 Make the Master CD Filesystem

At this point, you should have a source/KNOPPIX directory on a mounted hard drive that you have chrooted into and have changed to suit your needs [Hacks Section 9.3 and Section 9.4]. Now change to the source/KNOPPIX directory, download Klaus's scripts from http://debian.tu-bs.de/knoppix/debian/sarge-live-base/KNOPPIX.build.tar.gz, and unpack the file in that directory:

 root@ttyp0[hda1]#  cd source/KNOPPIX  root@ttyp0[KNOPPIX]#  wget   http://debian.tu-bs.de/knoppix/debian/sarge-live-base/KNOPPIX.build.tar.gz  root@ttyp0[KNOPPIX]#  tar xvzf KNOPPIX.build.tar.gz  KNOPPIX.build/ KNOPPIX.build/Knoppix-3.4.mkcompressed KNOPPIX.build/Knoppix.checklibs KNOPPIX.build/Knoppix.clean KNOPPIX.build/Knoppix.hardlinks KNOPPIX.build/Knoppix.mksortlist KNOPPIX.build/Knoppix.postupgrade KNOPPIX.build/Knoppix.removedocs KNOPPIX.build/mkcomp.diff KNOPPIX.build/create_compressed_fs KNOPPIX.build/mkisofs KNOPPIX.build/mkisofs.timestamp KNOPPIX.build/mkisofs.sort 

Now create the master directory to hold the filesystem for your CD-ROM; only this time, create it inside the new KNOPPIX.build directory. Then use rsync to copy all of the files other than the KNOPPIX/KNOPPIX compressed filesystem from the CD-ROM to the master directory:

 root@ttyp0[KNOPPIX]#  mkdir KNOPPIX.build/master  root@ttyp0[KNOPPIX]#  rsync -a exclude "/KNOPPIX/KNOPPIX" /cdrom/   KNOPPIX.build/master/  

One major difference when you use these scripts is that you run them from within the chroot environment. The chroot environment is necessary, because the script updates manpages and locate databases and runs other commands that expect the / to be the root of your remastered CD. Chroot to your source/KNOPPIX directory (if you are still in this directory, you can just use a dot [.] for the directory name ) and remount the / proc filesystem:

 root@ttyp0[KNOPPIX]#  chroot ./  root@ttyp0[/]#  mount -t proc /proc proc  

As you might imagine, Klaus's scripts are customized to suit how he builds his CDs. You won't use many of these features off the bat, and for the purposes of this chroot process, you must comment a line in the script to disable remounting the / filesystem read-only, as it fails from within chroot . Run the Knoppix-3.4.mkcompressed script to finish creating your CD, and then specify the master directory you have created in KNOPPIX.build to tell the script where to find the CD filesystem:

 root@ttyp0[/]#  perl -pi -e 's/^(mount -o ro)/#/  '  /KNOPPIX.build/Knoppix-3.4.mkcompressed  root@ttyp0[/]#  /KNOPPIX.build/Knoppix-3.4.mkcompressed /KNOPPIX.build/master  

This script creates a master.iso file under KNOPPIX.build , but if you type /KNOPPIX.build/master/ on the command line instead of /KNOPPIX.build/master (notice that there is no trailing /), then the script creates a file called .iso under the KNOPPIX.build/master/ directory. The file still works; it's just in a different place than you expected.

The first thing the script asks is whether you want to update the Knoppix version. This is your opportunity to update the version number to match your distribution versioning scheme:

 Update KNOPPIX version (3.4 2004-05-17) in file /KNOPPIX.build/master/KNOPPIX/knoppix-version and /etc/knoppix-version [N/y]?  y  [3.4 2004-05-17]  3.4 Knoppix Hacks  

For instance, this example changes the version from 3.4 2004-05-07 to 3.4 Knoppix Hacks. You are then asked to update boot files. Say "no" because you do not have the boot file directories the script is looking for. Next, you are asked to recreate the KNOPPIX compressed filesystem. Answer "yes" to create the master/KNOPPIX/KNOPPIX compressed filesystem image. Then the script asks if you want to sweep and clean the system before you remaster. Answer "yes" for the script to update your Debian package listings, refresh your manpages and locate databases, refresh your font caches, and clean the filesystem of unneeded files.

Now the script creates your compressed filesystem. This process takes the same amount of time as manually entering the mkisofs command, so sit back and browse the Web until the command completes. Once it finishes, you are asked:

 Recreate KNOPPIX-DE isofile '/KNOPPIX.build/master.iso'?  y  

Answer "y," even though it looks like the script is going to create a German version of the CD. Your CD is made from the English version, so all of the files it references are from the English version. After the script creates the CD image, it asks you:

 Recreate KNOPPIX-EN isofile '/KNOPPIX.build/master-EN.iso'?  n  BURN german CD version?  n  

Answer "n" to both questions, because the master.iso file is already the English version, and because you are likely booting from a Knoppix CD, your primary CD-ROM drive is not likely free for burning. At this point, your CD image is created and the script ends. Unmount the /proc filesystem, and then type exit or hit Ctrl-D to leave the chroot environment:

 root@ttyp0[/]#  umount /proc  root@ttyp0[/]#  exit  root@ttyp0[KNOPPIX]# 

Your new image is source/KNOPPIX/KNOPPIX.build/master.iso . To test the image, reboot the computer and type:

  knoppix bootfrom=  /dev/hda1/    source/KNOPPIX/KNOPPIX.build/master.iso  

at the boot prompt, replacing hda1 with your partition.

 < Day Day Up > 

Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net