Free Hosting Online for WorkStations

< Previous | Contents | Next >

8.4.3. Checksums, Conffiles‌


In addition to the maintainer scripts and control data already mentioned in the previous sections, the control.tar.gz archive of a Debian package may contain other interesting files:


# ar p /var/cache/apt/archives/bash_4.4-2_amd64.deb control.tar.gz | tar -tzf -


./

./conffiles

./control

./md5sums

./postinst

./postrm

./preinst

./prerm

./

./conffiles

./control

./md5sums

./postinst

./postrm

./preinst

./prerm


The first—md5sums—contains the MD5 checksums for all of the package’s files. Its main advantage is that it allows dpkg --verify to check if these files have been modified since their installation. Note that when this file doesn’t exist, dpkg will generate it dynamically at installation time (and store it in the dpkg database just like other control files).

conffiles lists package files that must be handled as configuration files. Configuration files can be modified by the administrator, and dpkg will try to preserve those changes during a package update.

In effect, in this situation, dpkg behaves as intelligently as possible: if the standard configuration file has not changed between the two versions, it does nothing. If, however, the file has changed, it will try to update this file. Two cases are possible: either the administrator has not touched this configuration file, in which case dpkg automatically installs the new version; or the file has been modified, in which case dpkg asks the administrator which version they wish to use (the old one with modifications, or the new one provided with the package). To assist in making this decision, dpkg offers to display a diff that shows the difference between the two versions. If you choose to retain the old version, the new one will be stored in the same location in a file with the .dpkg-dist suffix. If you choose the new version, the old one is retained in a file with the .dpkg-old suffix. Another available action consists of momentarily interrupting dpkg to edit the file and attempt to reinstate the relevant modifications (previously identified with diff).

dpkg handles configuration file updates, but, while doing so, regularly interrupts its work to ask for input from the administrator. This can be time consuming and inconvenient. Fortunately, you can instruct dpkg to respond to these prompts automatically. The --force-confold option retains the old version of the file, while --force-confnew will use the new version. These choices are respected, even if the file has not been changed by the administrator, which only rarely has the desired effect. Adding the --force-confdef option tells dpkg to decide by itself when possible (in other words, when the original configuration file has not been touched), and only uses --force- confnew or --force-confold for other cases.

These options apply to dpkg, but most of the time the administrator will work directly with the aptitude or apt programs. It is, thus, necessary to know the syntax used to indicate the options to pass to the dpkg command (their command line interfaces are very similar).


# apt -o DPkg::options::=”--force-confdef” -o DPkg::options::=”--force-confold” full-

upgrade

# apt -o DPkg::options::=”--force-confdef” -o DPkg::options::=”--force-confold” full-

upgrade

These options can be stored directly in apt’s configuration. To do so, simply write the following line in the /etc/apt/apt.conf.d/local file:


DPkg::options { ”--force-confdef”; ”--force-confold”; }

DPkg::options { ”--force-confdef”; ”--force-confold”; }


Including this option in the configuration file means that it will also be used in a graphical inter- face such as aptitude.

Conversely, you can also force dpkg to ask configuration file questions. The --force-confask option instructs dpkg to display the questions about the configuration files, even in cases where they would not normally be necessary. Thus, when reinstalling a package with this option, dpkg will ask the questions again for all of the configuration files modified by the administrator. This is very convenient, especially for reinstalling the original configuration file if it has been deleted and no other copy is available: a normal re-installation won’t work, because dpkg considers removal as a form of legitimate modification, and, thus, doesn’t install the desired configuration file.


Top OS Cloud Computing at OnWorks: