Hack 96 Personalize Knoppix

 < Day Day Up > 

figs/moderate.gif figs/hack96.gif

Customizing Knoppix doesn't just mean changing which packages get installed and what programs run at boot. You can also completely change which the default desktop environment looks and feels like .

So you have created your custom CDs with your custom applications and settings, but when you boot and see the same desktop and themes that vanilla Knoppix comes with, your distribution starts to seem a lot less custom. It's like souping up the engine on your hot rod without giving it a new paint job. With a tweak here and there, you can give your distribution a special look that makes it your own.

I have already covered how to customize the look and feel of your desktop in [Hack #11] . You might have noticed when you started remastering that the /home directory in the chroot environment was empty. This means that customizing the look of your desktop isn't as simple as changing the files in the /home/knoppix directory and copying them to the chroot environment.

9.4.1 Quick Desktop Tweaks

You can take advantage of a custom knoppix.sh script like one created with persistent settings [Hack #21] to shortcut many of these more disruptive tweaks and save yourself from the long process of creating a compressed KNOPPIX filesystem.

Start with the Section 9.2.4 step from [Hack #94] , create the master directory, and then copy all of the files from the CD-ROM, including the compressed KNOPPIX filesystem:

 root@ttyp1[hda1]#  mkdir master  root@ttyp1[hda1]#  rsync -a /cdrom/ master/  

Change the desktop to your liking, click K Menu KNOPPIX Configure Save KNOPPIX configuration, and then copy the knoppix.sh and configs .tbz files the script creates to the master/KNOPPIX directory. You can skip the step of creating the compressed master/KNOPPIX/KNOPPIX filesystem and go straight to creating the new CD image:

 root@ttyp1[hda1]#  mkisofs -pad -l -r -J -v -V  "  KNOPPIX  "  -no-emul-boot   -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c   boot/isolinux/boot.cat -hide-rr-moved -o  knoppix.iso    master/  

Once this command is completed, you should see a new knoppix.iso file in the root of your partition. When this image boots, Knoppix executes the knoppix.sh script you have copied to the CD, and unpacks your settings from configs.tbz .

9.4.2 Complete Desktop Tweaks

When Knoppix boots, it runs a script located at /etc/X11/Xsession.d/45xsession . This script not only handles which window manager gets loaded when you boot, but also copies configuration files from the /etc/skel directory to the /home/knoppix directory and even tells Knoppix to play the sound you hear when it loads the desktop environment.

To change desktop settings, start the remastering process [Hack #94] and go as far as the chroot section, then follow the different guides below to change specific settings. After you are finished making your changes, unmount the proc filesystem with:

 root@ttyp1[/]#  umount /proc  

Then press Ctrl-D to exit chroot . Now you are ready to pick up with the Section 9.2.4 section of [Hack #94] .

9.4.3 Change the Default Window Manager

To get a better understanding of how the 45xsession script works, I will demonstrate how to change which window manager Knoppix uses by default. [Hack #1] demonstrates how to use cheat codes to change the window manager Knoppix uses, but if you always plan to use a different window manager, you don't want to be bothered with typing in the cheat code every time.

The 45xsession script controls which window manager Knoppix uses based on the $DESKTOP environment variable. The script runs the /etc/sysconfig/desktop script if it exists; otherwise , it defaults to using KDE. If you want to default to FluxBox instead of KDE, follow the remastering process to the chroot stage, and create an /etc/sysconfig/desktop file containing the following line:

 DESKTOP="fluxbox" 

You can replace fluxbox with icewm , xfce , or any of the other window managers that are on Knoppix.

9.4.4 Change Desktop Environment Settings

If you dig further into the 45xsession script, you might notice a section full of rsync commands similar to the following:

 # Copy profiles if not already present                                          rsync -Ha --ignore-existing /etc/skel/{.acrorc,.Xdefaults,.gimp*,.gconf*, .bashrc,.nessus*, .links,.local,.lynx*,.qt,.xine,tmp} $HOME/ 2>/dev/null               [ "$USER" = "knoppix" ] && rsync -Ha --ignore-existing /usr/share/knoppix/profile/ {.acrorc,.Xdefaults,.bashrc,.nessus*,.links,.lynx*,.qt,.xine,tmp} $HOME/ 2>/dev/null [ "$USER" = "knoppix" -a -f /usr/share/knoppix/profile/.fonts.cache-1 ] && rsync -H --ignore-existing /usr/share/knoppix/profile/.fonts.cache-1 $HOME/ 2>/dev/null 

These series of commands copy default settings from the /etc/skel directory to /home/knoppix if they don't already exist. To change the appearance of KDE, click K Menu Settings Control Center and make your changes in the Appearance & Themes section. Once the wallpaper, themes, color scheme, and the desktop itself are arranged to your liking, open a terminal and synchronize your changes with the source/KNOPPIX filesystem.

 knoppix@ttyp0[knoppix]$  sudo rsync -a /home/knoppix/    /mnt/hda1/    source/KNOPPIX/etc/skel/  

If you are using a window manager other than KDE, it is likely that the 45xsession script does not automatically copy over your settings. This means that you must add a special entry to the source/KNOPPIX/etc/X11/Xsession.d/45xsession script yourself to manage copying over the settings. For instance, if you use fluxbox on the desktop, all of your settings are stored in the .fluxbox directory. Reference the startkde function inside the script that Knoppix uses to copy over KDE settings to see how you can do the same for .fluxbox :

 startkde( ){ # Play sound playsound if [ -z "$DONTCHANGE" ]; then # No persistent homedir, copy everything rsync -Ha --ignore-existing /etc/skel/{.kde*,Desktop} $HOME/ 2>/dev/null 

Find the startfluxbox function in the script that looks something like this:

 startfluxbox( ){ # Create automatic Desktop icons mkdesktophdicons playsound GDK_USE_XFT=1 exec fluxbox } 

Then modify it to look like this:

 startfluxbox( ){ # Create automatic Desktop icons mkdesktophdicons playsound if [ -z "$DONTCHANGE" ]; then # No persistent homedir, copy everything rsync -Ha --ignore-existing /etc/skel/{.fluxbox,Desktop} $HOME/ 2>/dev/null GDK_USE_XFT=1 exec fluxbox } 

Now you can synchronize all of your desktop settings just like with KDE:

 knoppix@ttyp0[knoppix]$  sudo rsync -a /home/knoppix/   /mnt/hda1/source/KNOPPIX/etc/skel/  

Of course, if you are using a different window manager, you must find its section in the script and modify the rsync command to use its configuration directory instead of .fluxbox .

9.4.5 Disable the Startup and Shutdown Sounds

The startup and shutdown sounds that Knoppix makes are useful indicators that the sound card is working. However, if you want your remastered CD to be quiet when it starts up, it is pretty simple to disable the sounds.

First, edit the source/KNOPPIX/etc/X11/Xsession.d/45xsession file. Find the startwindowmanager function in the script for your window manager (by default, startkde ). To disable the startup sound, simply comment out the playsound command for your window manager with a "#" character:

 startkde( ){ # Play sound #playsound 

Disabling the shutdown sound requires that you edit source/KNOPPIX/etc/init.d/xsession . Find the section in the script that looks like the following:

 # Play informational sound if soundcore module present # (checking /dev/sndstat is unreliable) OGGPLAY=/usr/bin/ogg123 PLAY=/usr/bin/wavp [ -x "$PLAY" ]  PLAY=/usr/bin/play-sample [ -x "$PLAY" ]  PLAY=/usr/bin/play if [ -x "$OGGPLAY" -a -f /usr/share/sounds/shutdown.ogg ]; then case "$(lsmod)" in *sound*) { $OGGPLAY -q -p 64 /usr/share/sounds/shutdown.ogg \ >/dev/null 2>&1 & } ; sleep 7 ;; esac elif [ -f /usr/share/sounds/shutdown.wav -a -x "$PLAY" ]; then case "$(lsmod)" in *sound*) { $PLAY /usr/share/sounds/shutdown.wav >/dev/null \ 2>&1 & } ; sleep 7 ;; esac fi 

Then comment out the complete if statement so that the section looks like this:

 # Play informational sound if soundcore module present # (checking /dev/sndstat is unreliable) OGGPLAY=/usr/bin/ogg123 PLAY=/usr/bin/wavp [ -x "$PLAY" ]  PLAY=/usr/bin/play-sample [ -x "$PLAY" ]  PLAY=/usr/bin/play #if [ -x "$OGGPLAY" -a -f /usr/share/sounds/shutdown.ogg ]; then #case "$(lsmod)" in *sound*) { $OGGPLAY -q -p 64 /usr/share/sounds/shutdown.ogg \ >/dev/null 2>&1 & } ; sleep 7 ;; esac #elif [ -f /usr/share/sounds/shutdown.wav -a -x "$PLAY" ]; then #case "$(lsmod)" in *sound*) { $PLAY /usr/share/sounds/shutdown.wav >/dev/null \ 2>&1 & } ; sleep 7 ;; esac #fi 

There are a lot more tweaks you can do once you get experienced with the scripts Knoppix uses to start the desktop environment. Read through the 45xsession script to find other ways you can tweak your desktop.

 < Day Day Up > 


Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 166

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