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

Bug#301434: Script hooks in main-menu

Package: debian-installer
Severity: wishlist

It would be nice to be able to run pre- and post- scripts between menu items.
That way I could supply custom scripts to do things like:

- - After the ethernet drivers are loaded, but before netcfg is run, execute a
  script that could look through the hardware addresses found and configure
  debconf netcfg settings appropriately.
- - After disk drivers are loaded, but before partman is run, execute a script
  that would dynamically create a partman-auto/expert_recipe based on the
  number and sizes of disks found (or based on the contents of /etc/hostname,
  for that mater).

  (Things like this might require ifconfig, sed, and awk?  I don't know if the
  compilation of busybox currently used has support for sed and awk, but it
  would be nice if all the basic unix scripting tools were available: sed, awk,
  grep, head, tail, cut, tr, expr, etc... as well as some basic networking
  tools like ping.  If the size of the ramdisk is an issue, then perhaps
  multiple ramdisks could be supplied.  For each ramdisk currently on the CD,
  a second, larger, script-happy version could be supplied just for goobers
  like me who want to automate everything.  ...This should probably be a
  separate wish.)

Two possible preseed methods come to mind:

1) Create something like preseed/intermediate_command to go along with
early_command and late_command, except this command is run between menu items.
The name of the last menu item processed and the next menu item to be
processed could be passed to the command as environment variables, that way
user-supplied scripts could know when to do what.  With a pair of shell case
statements the user could perform whatever tweaks are necessary between each
step.  That way, if I had a couple of scripts to configure the networking
(say, /auto-netconfig-script) and partitioning (say, /auto-partition-script)
as described above, I could generate a third script:

  # File: /intermediate-script

  # Assuming what's about to be run next by main-menu is stored in
  # the environment variable PRE_MENU_ITEM.
  case "${PRE_MENU_ITEM}" in

And I could specify it to debconf as:

  d-i preseed/intermediate_command string /intermediate-script

2) Create something like preseed/[pre|post]-<menu-item>_command that would
specify exactly when to run what command.  That way, if I had a couple of
scripts to configure the networking and partitioning as described above, I
could specify them thusly:

  d-i preseed/pre-netcfg_command string /auto-netconfig-script
  d-i preseed/pre-partman-auto_command string /auto-partition-script

Michael Peek

Reply to: