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

idea on how to automate the install (kickstart feature)



With the current 

File: netboot-initrd.gz
URL:
http://http.us.debian.org/debian/dists/testing/main/installer-i386/current/images
MD5SUM: 1451c0b18cddf2e4edd1d55d3b268c2d

I tried to automate the setup somewhat.


Basically, I made a normal install and copied the resulting
/var/lib/cdebconf/questions.dat. Then I search for entries that had a
"Value: " key and extracted them to a new, smaller questions.dat. I got
them something like

--------------------------------------------
Name: console-keymaps-at/keymap
Template: console-keymaps-at/keymap
Value: de-latin1-nodeadkeys
Owners: debian
Flags: seen

Name: console-tools/archs
Template: console-tools/archs
Value: PC-style (AT connector) keyboard
Owners: debian
Variables:
 choices = PC-style (AT connector) keyboard, USB keyboard

...

Name: netcfg/choose_interface
Template: netcfg/choose_interface
Value: eth1: Ethernet or Fast Ethernet
Owners: debian
Flags: seen
Variables:
 ifchoices = eth0: Ethernet or Fast Ethernet, eth1: Ethernet or Fast
Ethernet
--------------------------------------------


Finally, I did put this into my netboot imagerd and booted this via PXA.

This brought my so far that all the right answers were pre-selected.
Unfortunately, the dialogs were still displayed, despite the "Flags: seen"
fields. Not only in kbd-chooser, but also in other modules.

Here is a source-code excerpt from d-i-cvs/tools/netcfg/netcfg-common.c:

--------------------------------------------
int my_debconf_input(struct debconfclient *client, char *priority,
                     char *template, char **p)
{
    int ret = 0;
    debconf_fset(client, template, "seen", "false");
    debconf_input(client, priority, template);
    ret = debconf_go(client);
    debconf_get(client, template);
    *p = client->value;
    return ret;
}

...

        debconf_subst(client, "netcfg/choose_interface", "ifchoices", ptr);
        free(ptr);
        ret = my_debconf_input(client, "high",
                               "netcfg/choose_interface", &inter);
--------------------------------------------

So we basically need a differentiation for those three cases:

- value supplied by kickstarter
- redisplay of the dialog because of an error
- normal display

I' suggest that kickstarters like me set "Flags: kickstart". The
debconf_fset function get's a special case with the following pseudo-code:

  if currflag="kickstart" and newflag="false" and i_have_a_value_field then
     currflag="true"
  else
     currflag=newflag

In the case of no "kickstart"-Flag everything is as before.

In the case of a "kickstart"-Flag, the first set to "false" would set the
dialog to seen-flag to "true" and the next debconf_get would retrieve this. 

If for some reason the value of this field is erraneous and the dialog would
get called a second time, then the flag would originall be "true" and set
to "false" just as normal, making the dialog to appear.



I hope this is not too ugly. At least it saves us to change every
debconf_input occurence in scripts & c-code to check for extra cases.

-- 
Try Linux 2.6 from BitKeeper for PXA2x0 CPUs at
http://www.mn-logistik.de/unsupported/linux-2.6/



Reply to: