[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: howto interact with HW-detection of installer

On Thursday 29 October 2009, Geronimo Ma. Hernandez wrote:
> > There are several ways to get info about hardware:
> > - files in /sys or /proc
> > - utilities like lspci, lsusb, dmidecode (not all available in D-I)
> I see. So I have to do the detection on myself and add the tools I need
> for that to the installer?

You should be able to get most of what you need using info that's already 

> > base-installer is in most cases not the best place to install extra
> > packages. Doing that in pkgsel is preferred.
> Yes, I agree for extra packages. But I want to strip down the
> base-system (install a smaller image, use busybox with its targets, ...)

Creating a smaller image is one of the most difficult things to do. It 
requires a very high level of understanding of how Debian works in general 
(things like package priorities), the installer and e.g. debootstrap.

debootstrap can be tuned. To see how, read the bootstrap-base.postinst 
script and find the function install_base_system(). There you can see 
exactly how D-I calls debootstrap.

> Ok, let me explain what I want with a (quite senseless) sample:

Problem with senseless examples is that they make no sense ;-)
It's much easier to give concrete help when you give an actual example of 
what you want to do that _does_ make sense.

> Imagine, I would like to determine the type of desktop system based on
> the type of network-hardware found in the system

This you should be able to get from lsmod, lspci or /sys.

> and the user-question, whether he likes to use dhcp.

This can simply be tested in a script using a db_get of the relevant 
debconf template.

> So I need to check the hardware (i.e. lspci) and do a user-question.
> The result of both lead to a preseed-list and a path through the rest of
> the installation (pkgsel, ...)

Well, you cannot really change the *path* through the installation (or 
rather, IMO you should not want to). What you can do is change defaults 
(by setting values for existing debconf questions) and adding 
functionality (by adding hook scripts that are executed by various 
components (see /usr/lib/*.d), or by adding custom udebs).

But you probably need to start by spending some more time understanding the 
installer and reading existing scripts. Each installation step starts by 
executing a postinst script in /var/lib/dpkg/info. You can also learn a 
lot by adding a 'set -x' in such scripts before a step is executed and 
studying the debug output in the syslog, and then possibly adding 
additional 'set -x' in scripts called by those scripts.

Did you already read the preseeding appendix in the installation guide? 
That has quite a lot of information on customization.

Reply to: