# Debian packaging manual - chapter 13
dselect's interface to its installation methods

`dselect` calls scripts from its installation methods when it needs to actually access data from the distribution. The core program `dselect` itself just calls these scripts and provides the package and access method selection interfaces. The installation methods are responsible for invoking `dpkg` as appropriate.

Each installation method has three scripts:

- Setup installation parameters.
- Update list of available packages.
- Install.

`dselect` searches for methods in `/usr/lib/dpkg/methods` and `/usr/local/lib/dpkg/methods`.

## 13.1 Functions of the method scripts

The setup script is run just after the user has chosen an installation method. It should prompt the user for parameters like the site to NFS-mount or FTP from, the directory to use, or the directory or filesystem where the `.deb` files can be found, or the tape or floppy device to install from. It should store the responses under `/var/lib/dpkg/methods` - see below. If no available packages list is available it should perhaps offer to scan the available packages.

The update script should obtain a list of available packages if possible, and run `dpkg --update-avail`, `dpkg --merge-avail` and/or `dpkg --forget-old-unavail` to load it into `dpkg` and `dselect`'s database of available packages. If no packages list was available and the user was offered and accepted the option of scanning the actual files available this scan should be done here, using `dpkg --record-avail`.

The install script should feed all the available `.deb` files to `dpkg --iGOEB` (this is equivalent to `dpkg --install --refuse-downgrade --selected-only --skip-same-version --auto-deconfigure`). The `-R` (`--recursive`) option for traversing subdirectories may also be useful here).

If any of these scripts needs to display a message for the user, it should wait for the user to hit `return' before exiting so that dselect doesn't immediately rewrite the screen.

If a method script succeeds (returns a zero exit status) `dselect` will return immediately to the main menu, with the `next' option highlighted ready for the user to select it. If it fails `dselect` will display a message and wait for the user to hit return.

## 13.2 Location and arguments of the method scripts

A set of scripts (henceforth known as a group) may provide several methods on the `main menu' with different behaviour. For example, there might be a generic get-packages-by-FTP group which might provide methods in the main menu for installation directly from one of the Debian mirror sites as well as for installation from a user-specified site.

Each group of methods implemented by the same set of scripts should have a subdirectory `/usr/lib/dpkg/methods/`group`` or `/usr/local/lib/dpkg/methods/`group``, containing:

`names`
  a list of user-visible methods provided by these scripts.
`setup`
`update`
`install`
  executable programs, the scripts themselves.
`desc.`option``
  description file.

`names` will be formatted as a list of lines, each containing:

    sequence method summary

sequence is a two-digit number that will be used much like `rc.d` prefixes to control the order in the main menu. If in doubt use 50.

method is a name which is displayed by `dselect` as the name of the method, and which will be passed to `setup`, `update` and `unpack` as their first argument.

summary is the brief description string for `dselect`'s menu.

Each of the three scripts gets the same three arguments: vardir, group and method. vardir is the base directory for storing `dpkg` and `dselect`'s state, usually `/var/lib/dpkg`; this is passed in so that the `--admindir` option to `dselect` is honoured).

Each option may have an extended description in `desc.`option``. This should be formatted like the extended description part of a `Description` field entry shifted one character to the left.

``vardir`/methods` will exist, and a method group may use a ``vardir`/methods/`group`` directory to store its state.

The group name and method name must follow the rules for C identifiers.

Debian packaging manual - Copyright ©1996 Ian Jackson.
Contents; abstract; next; back.