8.4.2. Configuration Scripts
In addition to the
control
file, the
control.tar.gz
archive for each Debian package may contain
a number of scripts (
postinst
,
postrm
,
preinst
,
prerm
) called by
dpkg
at different stages in the
processing of a package. We can use
dpkg -I
to show these files as they reside in a
.deb
package
archive:
$
dpkg -I /var/cache/apt/archives/zsh_5.3-1_amd64.deb | head
new debian package, version 2.0.
size 814486 bytes: control archive=2557 bytes.
838 bytes,
20 lines
control
3327 bytes,
43 lines
md5sums
969 bytes,
41 lines
*
postinst
#!/bin/sh
348 bytes,
20 lines
*
postrm
#!/bin/sh
175 bytes,
5 lines
*
preinst
#!/bin/sh
175 bytes,
5 lines
*
prerm
#!/bin/sh
Package: zsh
Version: 5.3-1
$
dpkg -I zsh_5.3-1_amd64.deb preinst
#!/bin/sh
set -e
# Automatically added by dh_installdeb
dpkg-maintscript-helper symlink_to_dir /usr/share/doc/zsh zsh-common 5.0.7-3 -- ”$@”
# End automatically added section
The
Debian Policy
6
describes each of these files in detail, specifying the scripts called and the
arguments they receive. These sequences may be complicated, since if one of the scripts fails,
dpkg
will try to return to a satisfactory state by canceling the installation or removal in progress
(insofar as it is possible).