Installing extra packages into /target/
=======================================

The udeb packages can request extra packages to be installed into
/target/.  One way to use this is for grub-installer to request the
grub package to be installed, making it easier to set up the grub boot
loader.

The packages will be queued for installation until base-installer is
executed.  At this point, the queued packages will be installed, and
any requests for extra packages will be executed immediately.

The idea is to make it possible to request packages before
base-installer is installed, and at any point before finish-install is
executed.  When /target/ or /cdrom/ is umounted by finish-install, it
is to late to install extra packages.

The script supports displaying debconf configuration questions and,
if multiple CD/DVD sources are defined, media changes by apt-cdrom.

Usage
-----

The postinst or finish-install.d script for packages call a script to
queue or install a package.

  apt-install <package> ...

This script have the following return values:

 0 The package is installed, or was successfully installed into /target/
 1 The package is now queued for installation
 2 The package failed to install into /target/ (it was missing, or
   something else was wrong).

Packages just requesting an extra package, can ignore the return value:

  apt-install <package> || true

Packages with postinst script that need to use the installed package
right now, will need to check the return value before doing this:

  if apt-install <package> ; then
    # do stuff
  else
    echo "error: Unable to do stuff"
    exit 1
  fi

Implementation
--------------

The script will check if base-installer was successfully completed,
and in this case will run 'apt-get install' try to fetch and install
the packages.  If base-installer isn't completed, it will add the
package name to /var/lib/apt-install/queue.

At the end of the base-installer postinst script, it will check this
file and install the packages listed in the file, something like this:

  for pkg in `cat /var/lib/apt-install/queue` do
      apt-install "$pkg" || true
  done

Files
-----

  /bin/apt-install             - request a package installed into /target/
  /var/lib/apt-install/queue   - package queue, installed by base-installer
  /target/etc/apt/sources.list - file created when base-installer completes
