2005年3月7日星期一

Fw: Remaster Knoppix without Remastering

原文位置: http://www.oreillynet.com/lpt/wlg/5964

主要讲了saveconfig/knoppix的用法,以及新的knx-live-inst,另外还提供了一个新东西: http://klik.sourceforge.net


Remaster Knoppix without Remastering

http://www.oreillynet.com/lpt/wlg/5964

The saveconfig script
----------------

The
saveconfig script within Knoppix is probably the best way to "remaster"
Knoppix without remastering. You can type saveconfig from a terminal,
or otherwise you can click Kmenu->KNOPPIX->Configure->Save
Knoppix configuration. A simple GUI will pop up and allow you to choose
what categories of settings to save from desktop and program settings,
the entire Desktop directory, network settings, graphics settings, and
other system settings. Choose the settings to save, and the device to
save them to (from a list of detected devices Knoppix provides), and
the script does the rest, creating a configs.tbz and knoppix.sh file on
the device you chose.

Next time you boot, add the cheat code
myconfig=scan and Knoppix will scan all available devices for the
knoppix.sh script and then execute it. This script will extract
configs.tbz and otherwise restore your settings.

If you are the
kind of person who likes to hack around with things, you might think to
yourself: "Hmmm I bet I could tweak that knoppix.sh script and do other
things at boot." And you would be right, the knoppix.sh script is the
key to remaster Knoppix without remastering.

What is the knoppix.sh script?
----------------------

The
knoppix.sh file is a simple shell script. When Knoppix boots, it scans
the KNOPPIX directory on the CD for a knoppix.sh file (or if you use
the myconfig=scan cheat code, it will also scan other devices on your
system). If it finds this file, it will execute it. Windows users can
think of this file as an autoexec.bat script. You can basically put any
series of commands into this script and Knoppix will execute them upon
startup. A typical knoppix.sh script looks like this:

#!/bin/sh
[ "`id -u`" = "0" ] || { echo "You need root privileges to modify the system!" >
&2 ; exit 1; }
[ -d "$1" ] && CONFIGS="$1/configs.tbz"
[ -f "$CONFIGS" ] || CONFIGS="/cdrom/KNOPPIX/configs.tbz"
[ -f "$CONFIGS" ] || CONFIGS="/mnt/floppy/configs.tbz"
if [ -f "$CONFIGS" ]; then
echo "^[[1mExtracting config archive $CONFIGS...^[[0m"
tar -jpPtf "$CONFIGS" | while read i; do rm -f "$i"; done
tar -jpPxf "$CONFIGS" ; chown -R knoppix.knoppix /home/knoppix
fi

The
best way to get started with tweaking this file is to run the
saveconfig script once to generate a knoppix.sh file to work from.
There are some various checks this script runs, but its basic function
is to extract the configs.tbz file. Based on what settings you saved,
this file will overwrite settings in /etc or /home/knoppix. You can
simply change the configs.tbz file if you want and add or remove files
with the settings you want.

It's important to remember that
certain parts of the filesystem under Knoppix, such as all of /usr,
will be read-only even when the system completely boots, so this means
that the interesting areas you will be able to change are in /etc/ and
/home/knoppix/. Also, at the time knoppix.sh runs, /home/knoppix
doesn't exist yet (that directory is copied from /etc/skel later), so
while you might think that you can just add a cp filename
/home/knoppix/ command to the script, it will fail when you run it. If
you want to copy files to /home/knoppix, you will need to create a
tarball from / that includes those files, that way the /home/knoppix
directory will be created for you as that extracts.

Install Programs
-------------

While
this setup is typically used for saving your settings, you can also
work around having to install programs with this method. Knoppix has
two different popular methods for installing software directly to the
live CD, the included knx-live-inst.sh script (or click
Kmenu->KNOPPIX->Utilities->Install Software while running from
CD), or klik. Both of these programs install software directly into the
/home/knoppix directory and modify file paths so that they can run from
there. After you install programs with this method, you can save your
home directory and those programs will still be there the next time you
boot with myconfig=scan.

If your program isn't included in the
list of software you can live-install, you can attempt to install it to
the local path yourself. Of course this process will vary in difficulty
depending on the complexity of the software you want to install.



Powered by ScribeFire.

没有评论: