2.2.5 Debian maintenance scripts
Debian maintenance scripts are executable scripts which are automatically run
before or after a package is installed. Along with a file named
control, all of these files are part of the "control"
section of a Debian archive file.
The individual files are:
This script executes before its package is unpacked from its Debian archive
(.deb) file. Many "preinst" scripts stop services for
packages which are being upgraded until their installation or upgrade is
completed (following the successful execution of the "postinst"
This script typically completes any required configuration of a package once it
has been unpacked from its Debian archive (.deb) file. Often,
"postinst" scripts ask the user for input, and/or warn the user that
if he accepts default values, he should remember to go back and reconfigure the
package as the situation warrants. Many "postinst" scripts then
execute any commands necessary to start or restart a service once a new package
has been installed or upgraded.
This script typically stops any daemons which are associated with a package.
It is executed before the removal of files associated with the package.
This script typically modifies links or other files associated with a package,
and/or removes files created by it. (Also see
packages, Section 2.2.7.)
Currently all of the control files can be found in the directory
/var/lib/dpkg/info. The files relevant to package
foo begin with the name "foo" and have file extensions
of "preinst", "postinst", etc., as appropriate. The file
foo.list in that directory lists all of the files that were
installed with the package foo. (Note that the location of these
files is a
dpkg internal, and may be subject to change.)