D-i

From LocalizationWiki

Contents

Debian Installer Customization notes

This page explains the process of customizing Debian Installer and also throws some lights on the general Debian Installer framework.

A good description of the Debian Installer is given by Mr. Frans Pop at http://people.debian.org/~fjp/talks/debconf6/paper/

The following pages also explains about the Debian customization

http://wiki.debian.org/DebianInstaller/CustomImages
http://wiki.debian.org/DebianInstaller/Modify/CD

To build Debian Installer

To check the build dependencies from the installer directory

pema@pema:~/d-i/trunk/installer$ dpkg-checkbuilddeps

To install the build dependencies

# apt-get build-dep debian-installer
// You need to have a deb-src line in /etc/apt/sources.list

Normally building the installer using 'make' will create images based on udebs from unstable and those images will also retrieve additional udebs from unstable. As we want to base the customized installer on Etch instead, the following changes were made in installer/build/config/common:

PRESEED_SUITE ?=
SUITE ?= etch
pema@pema:~/d-i/trunk/installer/build$ make
// Displays all the build options available for all types of installation methods
pema@pema:~/d-i/trunk/installer/build$ make reallyclean
// Cleans up the generated files
pema@pema:~/d-i/trunk/installer/build$ fakeroot make build_netboot
// Builds the debian installer used for installing using network

Note: A local debian mirror is needed in place for creating Debian Installer CD images using debian-cd. The installer should be built either in etch/sid environment.

Information regarding the size of the mirrors is shown at http://www.debian.org/mirror/size

Important: The easiest way to test the installer is to create a mini.iso (using the build_netboot target); to test the graphical installer (g-i) use the build_gtk-miniiso target instead.

Script to create a local mirror for etch and sid for i386 and 64 bit architecture

Note: Script created by Mr. Frans Pop to create (and update) a local mirror. Run it as a regular user, not as root! You need to have the package 'debmirror' installed.

The value for MIRROR_HOSTNAME can probably be found using ping:

$ ping ftp.jp.debian.org
PING ftp.jp.debian.org (203.178.137.175) 56(84) bytes of data.
64 bytes from ftp.nara.wide.ad.jp (203.178.137.175): icmp_seq=1 ttl=39 time=278 ms

In this case the MIRROR is "ftp.jp.debian.org" and MIRROR_HOSTNAME is "ftp.nara.wide.ad.jp" (see last line). Replace by a mirror that is close to you and has the architectures you want to mirror. Note: some mirrors do not have source files. See the manpage for debmirror for an explanation of options used.

To see what's happening, run the script with the -v option.

#!/bin/bash
debmirror_flags="$@"
VERBOSE=""
if echo "$@" | grep -q -- "-v" ; then
       VERBOSE=1
fi
MIRROR=ftp.jp.debian.org
MIRROR_HOSTNAME=ftp.nara.wide.ad.jp
MDIR=debian
LOCAL=/srv/debmirror/debian/
LSTAMP="$LOCAL/project/trace/$(hostname -f)"
if wget -q "http://$MIRROR/debian/project/trace/$MIRROR_HOSTNAME" \
       -O $LOCAL/../newstamp; then
       if [ -s $LSTAMP ] && \
          [ $(date -f $LOCAL/../newstamp +%s) -le $(date -f $LSTAMP +%s) ]; then
               [ "$VERBOSE" ] && echo "Mirror is already up-to-date"
               exit 0
       fi
else
       echo "Failed to retrieve mirror stampfile"
       exit 1
fi
debmirror $debmirror_flags \
   --arch=i386,amd64 \
   --dist=etch,sid \
   --section=main,main/debian-installer,contrib,non-free \
   --method="http" \
   --postcleanup \
--ignore-small-errors \
   --ignore=dists/ --ignore=project/ --ignore=tools/ \
   --ignore=doc/ --ignore=indices/ \
   --ignore='.*README.*' --ignore='.*ls-lR.*' \
   --include='indices/*' --include='tools/*' --include='doc/*' \
   -h $MIRROR $LOCAL | \
   egrep -v "^gpg: (Signature made|Good signature)"
[ "$VERBOSE" ] && echo ""
[ "$VERBOSE" ] && echo "Starting rsync for ./doc"
rsync -aq --progress rsync://$MIRROR/$MDIR/README* $LOCAL
rsync -aq rsync://$MIRROR/$MDIR/doc $LOCAL
[ "$VERBOSE" ] && echo "Starting rsync for ./indices"
rsync -aq rsync://$MIRROR/$MDIR/indices $LOCAL
[ "$VERBOSE" ] && echo "Starting rsync for ./tools"
rsync -aq rsync://$MIRROR/$MDIR/tools $LOCAL

General configuration required for building packages

To change the editor from nano to vim:
$ sudo update-alternatives --config editor

In order to ensure clean builds (without SVN or CVS files in the source packages for example) and for easier use of use some of the developer scripts, you should ensure that correct environment variables are set.

$ vi ~/.devscripts
# The following parameters provide basic setup of your build environment
DEBEMAIL="'Pema Geyleg <pema.geyleg@gmail.com>'"
DEBSIGN_MAINT="'Pema Geyleg <pema.geyleg@gmail.com>'"
DEBSIGN_KEYID="4C8896DF"
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -ICVS -I.svn -uc -us"
DEBUILD_ROOTCMD="fakeroot"
DEBUILD_PRESERVE_ENVVARS=DH_ALWAYS_EXCLUDE
$ vi ~/.bashrc
Add the following lines:
export DEBEMAIL="pema.geyleg@gmail.com"
export DH_ALWAYS_EXCLUDE=CVS:.svn

Creating a font udeb

 http://www.dit.gov.bt/admin/index.php?title=Main_Page:font-udeb

font-udeb

Customization of Debian Installer

1. Make Debian Installer support only two languages: Dzongkha and English.

2. Set the default language to Dzongkha and the default country to Bhutan.

3. Ensure the Dzongkha locale is also created when English locale is used and English locale is created when the Dzongkha locale is used.

Note: Customization of components is done by creating a new udeb file for
that component; the udeb should have a higher version number than the
current official version and must be placed in installer/build/localudebs
while building the installer. This only works for udebs that are included
in the initrd for a particular installation method.
Important: Commands used while creating the customized udeb
          dch, dch -i // for making appropriate changes in the debian/changelog file
          debuild     // for building the debian package
All three changes can be achieved with component customization of localechooser.
pema@pema:~/d-i/trunk/packages/localechooser$ svn st
M      languagelist
M      debian/localechooser.templates-in
M      debian/changelog
M      localechooser
languagelist - Removed languages other than Dzongkha and English
localchooser.templates-in - Changed default language to Dzongkha
localechooser - Set default country to Bhutan (BT)
localechooser - Added the following code after the comment
# Ask for additional locales to be generated
near the end of the file.
   
    # For localized installs make sure both en_US and dz_BT will be generated
       EXTRALOCALE=""
       case $LOCALE in
           en_US*)
               EXTRALOCALE=dz_BT ;;
           dz_BT)
               EXTRALOCALE=en_US.UTF-8 ;;
       esac
       if [ "$EXTRALOCALE" ] && cat $SUPPORTEDLOCALES | grep -q $EXTRALOCALE; then
               SUP_LOCALE="$LOCALE, $EXTRALOCALE"
       else
               SUP_LOCALE="$LOCALE"
       fi
 
       db_subst $supportedlocales LOCALELIST "$CHOICES"
       db_fget $supportedlocales seen
       if [ "$RET" = false ]; then
               db_set $supportedlocales "$SUP_LOCALE"


4. Changing the image in the g-i and the color of the progress bar

5. Changing the default font size

This is also achieved with component customization of rootskel-gtk
pema@pema:~/d-i/trunk/packages/rootskel-gtk$ svn st
M      debian/changelog
M      src/usr/share/graphics/logo_debian.png
M      src/usr/share/themes/Clearlooks/gtk-2.0/gtkrc
M      src/etc/gtk-2.0/gtkrc
logo_debian.png - replaced with our choice of the logo
src/usr/share/themes/Clearlooks/gtk-2.0/gtkrc
In my case, the color of the progress bar has been changed to   
orange according to the logo used.
src/etc/gtk-2.0/gtkrc - Changed the size of the font to 10

6. Changing the default Dzongkha font

Note: Font udev needs to be created first as described in    
http://www.dit.gov.bt/admin/index.php?title=Main_Page:font-udeb
font-udeb
The change of the font used for Dzongkha is made in the file:
installer/build/pkg-lists/gtk-common

7. Changing the default keyboard and mirror using preseeding in initrd.

This is done by including the preseed.cfg file in the initrd.
  
Created the file installer/build/preseed.cfg.
Linked that file to be used by the installer by mentioning in the PRESEED option in    
installer/build/config/common file.
Note: Detailed notes on preseeding are available at
http://d-i.alioth.debian.org/manual/en.i386/apb.html

8. How to change the default boot background image

By default the background image used during the initail boot process is
klowner.rle found in installer/build/boot/x86/pics
The klowner.rle is set as SPLASH_RLE=boot/x86/pics/klowner.rle in installer/build/config/x86.cfg 
The process of creating a customized image for it is provided in klowner.README
file found in the same directory

9. Changing the default boot method to graphical installer.

The default boot method is install. Following boot options are available:
install
linux
installgui
expert
expertgui
rescue
rescuegui
auto
autogui
 
To have a default boot method to graphical installer, change the default to
installgui in the /installer/build/boot/syslinux.cfg.withgtk file.
Setting this options affects the hd-media and CD/DVD installation methods only.

Testing the d-i iso files using qemu

// Install qemu 
# apt-get install qemu
# aptitude install qemu
// Installing Debian Installer using qemu
// Create a hard disk image for use with qemu
$ qemu-img create /home/pema/qemu-hda.img 3G
// Install using the iso to the hard disk image
$ qemu -hda /home/pema/qemu-hda.img -cdrom dest/gtk-miniiso/mini.iso -boot d
// Run the installed system on the hard disk image
$ qemu -hda /home/pema/qemu-hda.img -cdrom dest/gtk-miniiso/mini.iso

Building CD/DVD images for i386 using debian-cd

This section contains notes for creating the Debian Linux iso images for i386 architecture. In this section only general changes that make it a bit easier to use debian-cd are documented. Customization of the images will be covered in later sections.

1. Creating the D-I images needed for the final CD/DVD image using the debian-cd package.

Normally d-i images are available from the Debian mirrors, for example:
http://ftp.nl.debian.org/debian/dists/testing/main/installer-i386/
 
This location could be used by debian-cd but, especially if you want to use custom images,
it is simpler if the images can be copied from a location on the harddisk.
To create the d-i images from the d-i source.
installer/build$ fakeroot make all_build
The images are found under the installer/build/dest/ directory as shown below:
pema@pema:~/d-i/trunk/installer/build$ ls dest/
cdrom  floppy  gtk-miniiso  hd-media  MANIFEST  MANIFEST.udebs  netboot
Setting up the d-i images to be used by debian-cd package.
$ mkdir /srv/d-i_images/i386
Copy all the d-i images into the /srv/d-i_images/i386 directory
To tell debian-cd to use the images from this location, set the following
environment variable (see step 3 below):
DI_DIR=/srv/d-i_images/i386

2. Downloading debian-cd from subversion and setting up the necessary changes for building.

Download debian-cd from svn://svn.debian.org/svn/debian-cd repository
Customizing debian-cd for building for the i386 architecture.
These changes are only needed if you don't have a full local mirror
(i.e. a mirror containing all architectures)
pema@pema:/srv/projects/debian-cd$ svn st
 M      tools/generate_di+k_list
 M      tools/generate_di_list
  
debian-cd/tools/generate_di_list: removed all other architecture except for i386. 
Hint: search for the line @ARCHES=qw
debian-cd/tools/generate_di+k_list: removed all the other architecture except for i386. 
Hint: search for #ifdef ARCH_alpha

3. Setting up the build variables needed by the debian-cd package

Create custom shell script to work as a wrapper for build.sh. It sets up the
necessary environment variables, runs some preliminary commands and eventually
calls build.sh.
Some preparation done by the wrapper script:
- get and extract the current version of debootstrap and make sure that that version
  will be used while running debian-cd
- update the files tasks/debian-installer-etch and tasks/debian-installer+kernel-etch
  by running the scripts tools/generate_di_list and tools/generate_di+k_list
Click this link to view the mybuild.sh wrapper script:
http://www.dit.gov.bt/admin/index.php/Main_Page:mybuild
mybuild
Copied the debian-cd/CONF.sh to debian-cd/CONF-dzongkha.sh and customized that. This
configuration file will be sourced when debian-cd is run. Some of the changes in it are
needed so we don't lose the environment variables set in the mybuild.sh wrapper script.
Here is the diff for the above two files:
http://www.dit.gov.bt/admin/index.php/Main_Page:conf-diff
conf-diff
To create a business card, netinstall, full CD or DVD image respectively,
run the mybuild.sh wrapper script as follows:
./mybuild.sh bc
./mybuild.sh netinst
./mybuild.sh full
./mybuild.sh dvd

Customization of packages included on CDs and installed by the installer

There can be several reasons why you want to change which packages are included on the first (and following) CDs and which packages are installed by selecting tasks in the installer. It is also possible to include (versions of) packages which are not available on the regular Debian mirrors.

Customizing this involves dealing with some fairly tricky interaction between tasksel and debian-cd.

If you want to include any custom versions of packages that also exist in Debian, you will need to ensure that the version of your custom package is higher than the version of the official package. And you probably want to make sure that the version stays higher for the duration of a stable release. We have decided to use '-99dzongkhaX' (with X starting at 1 and increasing for custom versions) as that will ensure the custom version will always be higher than stable updates, but not higher than the next upstream release. This makes it possible for users to smoothly upgrade to new official versions, assuming that they will include an up-to-date Dzongkha localization and translation.

debian-cd works basically by filling CDs with stuff one by one, in the following order:

* some basic documentation and utilities (all CD types)
* files and udebs needed for debian-installer (all CD types)
* kernel packages (netinst, full CD, DVD)
* packages that make up the base system (netinst, full CD, DVD)
* packages with priority "standard" (full CD, DVD)
* packages that are listed as essential for tasks (full CD, DVD)
* packages that are listed as optional for tasks (full CD, DVD)
* any other packages based on popularity (full CD, DVD)

Customizing tasksel

There were three goals:

* do not show the server tasks during installation
* change the contents of the Desktop task in line with available translations
* include an extra font in the dzongkha-desktop task

To do any customization of the contents of tasks in tasksel, a fundamental change in the way tasks are composed is needed. Normally tasksel will take the information of which packages make up a task from the packages control files included mirrors or on CDs, not from files included in the tasksel package. As you cannot easily change this information on mirrors or CDs, it is easier to change the definitions of tasks so that the information will be included in the tasksel package itself instead.

Making server tasks not displayed in the installer
Main reason to exclude the server tasks is to make things simpler for
inexperienced users. As the default server tasks may still be useful for
some people, we decided to keep the included when tasksel is run manually
after the installation.

The needed change is then simple. Just add the following line in the relevant
tasks (file-server, web-server, dns-server, mail-server, etc.):
Test-new-install: skip show
See also the README and tests/new-install in the tasksel source.
Customizing the contents of tasks
To change which packages are installed when a task is selected, two changes are
needed. The easy change is to modify the list of packages in the task. Make sure
they are listed in order of importance and keep in mind that dependencies will be
installed automatically.

The other change is to make tasksel include the package list for a task in the
package itself and not take it from the package control file. This is explained in
the README in the tasksel source.
Basically we need to replace the following two lines:
   Packages: task-fields
   Packages-list:
by:
   Packages: list
The list of packages follows that line (indented with 2 spaces).

This change was made in the tasks desktop, gnome-desktop and dzongkha-desktop.

After you've made the changes, make sure to give the package a correct version and build it.

Making the changed task definitions be used in debian-cd

First step is to install the customized tasksel on the system that holds your local mirror and on which you run build the CDs using debian-cd.

After that you have to update the following files in debian-cd:

* tasks/task.list: list only the tasks you want
* tasks/task-essential-etch: needs to be cleared and regenerated
* tasks/task-full-etch: needs to be cleared and regenerated

Start by updating the first file manually. Next you have to delete the packages listed in the second and third file (delete only the list of packages, not the whole file). Finally you can run the following commands to update these files.

To update tasks/task-essential-etch, run the commands listed in the comment at
the top of the file itself.
Updating tasks/task-full-etch is a bit more difficult. The commands listed in
the file itself assume that the task contents can be taken from the package
control file. However, all tasks we have in tasks/task.list have the task
contents included in tasksel itself.

Therefore we use the following commands instead:
for i in $(cat task.list); do \
  if [ "$i" != kde-desktop ] && [ "$i" != xfce-desktop ]; then \
     grep-dctrl -F Task -e "^$i$" /usr/share/tasksel/debian-tasks.desc | \
     grep-dctrl -s Packages -e '.*' | egrep -v "^Packages:"; \
  fi; \
done | sed -e 's? *??' | grep -v ^$ >> ./task-full-etch

Including custom packages on CD/DVD images

This involves creating a local repository separate from the local mirror with the official Debian packages. debian-cd can be set up so it will consider packages from both sources, and any packages taken from the local repository will be included in a corresponding local repository on the CD. The installer is smart enough to automatically use a local repository if it finds one on the CD.

Remember that the versions of the customized packages in the local repository need to be higher than the official packages for them to be included.

1. Create the local repository

The local repository should have the following structure:
./dists/$CODENAME/local/binary-$ARCH/
The Dzongkha custom packages have been placed at:
/srv/local-packages/debian-local/dists/etch/local/binary-i386
After you add (or remove) packages from the local repository, you need to
create/update the Packages file for it. The following script can be used for that:
$$$$ FIXME: needs to be added by Pema $$$$

2. Tell debian-cd to use the local repository

To do this we set the following environment variables in CONF-dzongkha.sh:
  export LOCAL=1
  export LOCALDEBS=/srv/local-packages/debian-local

Currently one additional change is needed: debootstrap versions up to version 0.3.3 miss a piece of functionality that makes it ignore packages in local repositories when installing the base system. This was fixed in version 0.3.3.1, which should be included in Etch early December 2006. For details read the bug report http://bugs.debian.org/398762

Which packages you include in the local repository is up to you. If you customized tasksel, make sure to include that too.

Other customization of debian-cd

There is a lot more customization possible in debian-cd.

For example, we do not want to offer the advanced guided partitioning options (LVM and encrypted LVM) available in Debian Installer. This was done by excluding the relevant udebs from the CD.

To exclude specific udebs from a CD, add them in data/etch/exclude-udebs:
# For Dzongkha linux we do not want to offer advanced auto-partitioning
partman-auto-lvm
partman-auto-crypto

Building custom Debian Packages

http://www.dit.gov.bt/admin/index.php?title=Main_Page:custom-packages
custom-packages

TODO

Necessary

1. Remove the hack to fix the debootstrap in the dzongkha-custom udeb when the debootstrap 0.3.3.1 is in testing.
2. Use the original localechooser with preseeding when a fixed cdebconf-gtk udeb is in testing.
3. Change the mirror in the preseeding to correct location (country) and not to local mirror.
4. When etch is released, change symlink to etch in local mirror from testing to stable and decide to add on testing.

Wishlist

1. Trying out splashy
 Its the matter of customizing the splashy package and installing it.
2. Trying out bootsplash
 Can't say! Might have to ask the people at Ubuntu.

Would be necessary

1. Customized GDM theme
 Might need to customize the gdm package.
2. Customized gnome desktop images
 Might have to customize the gnome-background package.