This is a basic rescue mode implementation for d-i.

To include this in an image, add 'rescue-check' to the appropriate file in
pkg-lists. rescue-check will retrieve rescue-mode itself if need be. If
you're building a monolithic image, note that that image type doesn't
include a retriever, so you need to add 'rescue-mode' too.

To use, boot with 'rescue/enable=true', and optionally
'rescue/root=<device>'. I anticipate that bootloader configurations will
eventually include a 'rescue' option with 'rescue/enable=true' set.


Rescue operation scripts
========================

After asking for the root filesystem, rescue-mode displays a menu of various
operations that can be performed on this filesystem. Some of these
operations are provided by rescue-mode, while others may be provided by
separate udebs (such as bootloader reinstallation).

Any udeb may install an executable script in /lib/rescue.d/; the name of
this script should begin with two digits, which provide a consistent menu
order, and the name may not contain "." or ":". It must provide a debconf
template of type text called "rescue/menu/<name>" where <name> is the name
of the script with the sequence number removed; the description of this
template will be used to construct the rescue menu. It may also provide a
debconf template of type text called "rescue/<name>/intro", which will be
displayed before running the script.

Rescue scripts should exit with code 0 if all went well, or if they handled
any errors themselves, or 10 to go back and select a different root
filesystem. Any other exit code will cause a generic error message to be
displayed, but in general rescue scripts should handle errors themselves and
exit zero.

To include an item in the rescue menu only if some condition is true, udebs
may install <script>.tst scripts in /lib/rescue.d/ which exit zero if the
item should be included and non-zero otherwise.
