Читаем The Debian Administrator's Handbook полностью

dpkg removes all of the package's files, with the exception of the configuration files and configuration scripts.

dpkg executes postrm remove. All of the configuration scripts, except postrm, are removed. If the user has not used the “purge” option, the operations are completed there.

For a complete purge of the package (command issued with dpkg --purge or dpkg -P), the configuration files are also deleted, as well as a certain number of copies (*.dpkg-tmp, *.dpkg-old, *.dpkg-new) and temporary files; dpkg then executes postrm purge.

VOCABULARY Purge, complete removal

When a Debian package is removed, the configuration files are retained in order to facilitate possible re-installation. Likewise, the data generated by a daemon (such as the content of an LDAP server directory, or the content of a database for an SQL server) are usually retained.

To remove all data associated with a package, it is necessary to “purge” the package with the command, dpkg -P package, apt-get remove --purge package or aptitude purge package.

Given the definitive nature of such data removal, purge should not be taken lightly.

The four scripts detailed below are complemented by a config script, provided by packages using debconf to acquire information from the user for configuration. During installation, this script defines in detail the questions asked by debconf. The responses are recorded in the debconf database for future reference. The script is generally executed by apt prior to installing packages one by one in order to group all the questions and ask them all to the user at the beginning of the process. The pre- and post-installation scripts can then use this information to operate according to the user's wishes.

TOOL debconf

debconf was created to resolve a recurring problem in Debian. All Debian packages unable to function without a minimum of configuration used to ask questions with calls to the echo and readcommands in shell scripts such as postinst and similar scripts. But this also means that during a large installation or update the user must stay with their computer to respond to various questions that may arise at any time. These manual interactions have now been almost entirely dispensed with, thanks to the debconf tool.

debconf has many interesting features: it requires the developer to specify user interaction; it allows localization of various strings of characters posted (all translations are stored in the templates file describing the interactions); it has different display models for presenting the questions to the user (text mode, graphical mode, non-interactive); and it allows creation of a central database of responses to share the same configuration with several computers... but the most important is that it is now possible to present all of the questions in a block to the user prior to starting a long installation or update process. The user can go about their business while the system handles the installation on its own, without having to stay there staring at the screen waiting for questions.

5.2.3. Checksums, List of Configuration Files

In addition to the configuration files mentioned in the previous sections, the control.tar.gz file in a Debian package contains others. The first, md5sums, contains the list of digital fingerprints for all of the package's files. Its main advantage is that it allows a tool such as debsums (which we will study in Section 14.3.3.1, “Auditing Packages: debsums and its Limits”) to check if these files have been modified since their installation.

conffiles lists package files that must be handled as configuration files. This involves a special handling, since configuration files can be modified by the administrator, and the changes are usually preserved during a package update.

Перейти на страницу:

Похожие книги