Difference between revisions of "Remastering Hacks"


From Knoppix Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
== Installing software and clearing up space with Apt ==
+
There are so many howtos cropping up, each with individual tips and customization examples for Knoppix remasters, that it seems good to have a place to put generic tips, no matter how you go about remastering, be it using scripts, completely by hand, or via a HD install, Morphix, etc...  Please add your tips and example "hacks" here. 
 +
 
 +
= Installing software and clearing up space with Apt =
 +
== Removing a bunch of Internationalization support to save space`using Apt and grep ==
  
 
The  following command returns a listing of all packages installed.
 
The  following command returns a listing of all packages installed.
Line 16: Line 19:
  
 
  apt-get remove openoffice-de-en manpages-de trans-de-en
 
  apt-get remove openoffice-de-en manpages-de trans-de-en
 +
 +
== Other packages commonly removed for custom images ==
  
 
Remove enigma and bacula as follows:
 
Remove enigma and bacula as follows:
Line 26: Line 31:
  
 
This results in a reasonable base to begin updating and adding packages to this system. First configure /etc/apt/sources.list and add the appropriate entries for a local Debian mirror.
 
This results in a reasonable base to begin updating and adding packages to this system. First configure /etc/apt/sources.list and add the appropriate entries for a local Debian mirror.
 +
 +
== What to do when behind a proxy ==
  
 
If you are behind a proxy and must authenticate against it to access the internet, then use the following command.
 
If you are behind a proxy and must authenticate against it to access the internet, then use the following command.
 
export http_proxy="http://username:passwd@yourproxy.company.com:portnumber/"
 
export http_proxy="http://username:passwd@yourproxy.company.com:portnumber/"
 +
 +
== Useful packages for install packages and cleaning up locales ==
  
 
Add three useful packages:
 
Add three useful packages:
Line 39: Line 48:
  
 
Aptitude is a console menu front end to apt and dpkg.
 
Aptitude is a console menu front end to apt and dpkg.
 +
 +
== Updating packages ==
  
 
Finally, update the system's package listing with the command:
 
Finally, update the system's package listing with the command:

Revision as of 05:02, 11 November 2005

There are so many howtos cropping up, each with individual tips and customization examples for Knoppix remasters, that it seems good to have a place to put generic tips, no matter how you go about remastering, be it using scripts, completely by hand, or via a HD install, Morphix, etc... Please add your tips and example "hacks" here.

Installing software and clearing up space with Apt

Removing a bunch of Internationalization support to save space`using Apt and grep

The following command returns a listing of all packages installed.

dpkg-query -l | less

While that command is useful, you can use grep to sort out which packages you to remove. The following command shows me packages that kde uses for internationalization support and strips off all the other extraneous information.

dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3

I can feed this to apt-get so that it will remove those packages.

apt-get remove `dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3`

You could remove openoffice and other German tools as follows:

apt-get remove openoffice-de-en manpages-de trans-de-en

Other packages commonly removed for custom images

Remove enigma and bacula as follows:

apt-get remove enigma bacula-common

Remove emacs as follows:

apt-get remove emacs21 emacs21-bin-common emacs21-common emacsen-common gettext-el zile

This results in a reasonable base to begin updating and adding packages to this system. First configure /etc/apt/sources.list and add the appropriate entries for a local Debian mirror.

What to do when behind a proxy

If you are behind a proxy and must authenticate against it to access the internet, then use the following command. export http_proxy="http://username:passwd@yourproxy.company.com:portnumber/"

Useful packages for install packages and cleaning up locales

Add three useful packages:

apt-get install localepurge aptitude

Localepurge will only keep the locales that are marked. This means that it will free up additional space. After running through the configuration removing locales you don't need, you must run it from the command line:

localepurge

Aptitude is a console menu front end to apt and dpkg.

Updating packages

Finally, update the system's package listing with the command:

apt-get -y update

Package updates within the GUI

apt-get install synaptic

Synaptic is a graphical front end to apt & dpkg.

Other customizations

Boot

Boot images

When using this method, will be located somewhere like <path-to-remaster dir>KNOPPIX.build/Knoppix.Master/KNOPPIX-CUSTOM/KNOPPIX/images/

Desktop

To keep certain desktop settings persistent

I must now mention the file /etc/X11/Xsession.d/45xsession. This script controls how knoppix behaves & how knoppix creates the knoppix user's home directory.

Edit the file /etc/X11/Xsession.d/45xsession and look for the ninth occurence of rsync in the script and it is found at or around line 128:

126: if [ -z "$DONTCHANGE" ]; then
127: # No persistent homedir, copy everything
128: rsync -Ha --ignore-existing /etc/skel/{.kde*,Desktop} $HOME/ 2>/dev/null
129: [ "$USER" = "knoppix" ] && rsync -Ha --ignore-existing /usr/share/knoppix/profile/{.kde*,Desktop} $HOME/ 2>/dev/null


It is line 128 which populates the /home/knoppix folder. So In line 128, I delete from & including the { to the }. It is changed as follows.

126: if [ -z "$DONTCHANGE" ]; then
127: # No persistent homedir, copy everything
128: rsync -Ha --ignore-existing /etc/skel/ $HOME/ 2>/dev/null
129: [ "$USER" = "knoppix" ] && rsync -Ha --ignore-existing /usr/share/knoppix/profile/{.kde*,Desktop} $HOME/ 2>/dev/null

Make the change and save the 45xsession file.

Making a permanent desktop background change

Replace the <path to chroot env>/KNOPPIX.build/Knoppix.Master/KNOPPIX-CUSTOM/KNOPPIX/background.png from outside the chroot env to be the one you would like for the default desktop background.

Changing the desktop splash screen

Replace /usr/share/apps/ksplash/Themes/Default/splash_top.png

(400X248 px is the normal size of this image)

Adding Icons

Plonk them into /etc/skel/Desktop or if you are working under a knoppix home directory, plonk them there. Under any KDE or GNOME system you can find examples of the format for these files.

Adding init scripts that should run

Say you need to make sure certain services are started up at boot time. You would think you could put them in the proper /etc/rc<num>.d/ directory and they would just work eh. Ha. Ha. To get something to always start, you have to actually modify the /etc/init.d/knoppix-autoconfig script and have it start the services. The init scripts will always be in the /etc/init.d/ directory, but they won't stay in the /etc/rc<num>.d directories, even if you put them there. It will make you sad.

For example, to add a custom vpn script and turn on some of the NFS client utils, one could add some lines after the automounty stuff:

# Start automounter now
/etc/init.d/autofs start >/dev/null && echo "${GREEN}Automounter started for: ${MAGENTA}${AUTOMOUNTS}${GREEN}.${NORMAL}"
fi
#
# CUSTOM SCRIPTY STUFF
#
if [ -f /etc/init.d/portmap ] ; then
        /etc/init.d/portmap start >/dev/null && \
        echo "${GREEN}Portmapper started for: ${MAGENTA}${AUTOMOUNTS}${GREEN}.${NORMAL}"
fi
if [ -f /etc/init.d/nfs-common ] ; then
        /etc/init.d/nfs-common start >/dev/null && \
        echo "${GREEN}NFS Common Services started for: ${MAGENTA}${AUTOMOUNTS}${GREEN}.${NORMAL}"
fi
# Start VPN
if [ -f /etc/init.d/vtundvpn ] ; then
        /etc/init.d/vtundvpn start >/dev/null && \
        echo "${GREEN}VPN started for: ${MAGENTA}${AUTOMOUNTS}${GREEN}.${NORMAL}"
fi
#
# END CUSTOM SCRIPTY STUFF
#