Postinst means: “AFTER the files have been Copied To the Device, THEN Run this Script.”
Preinst means: “BEFORE the files Get Copied To the Device, Run this Script, THEN Copy the files To the Device.”
Postrm means: “AFTER the files have been Removed From the Device, THEN Run this Script.”
Prerm means: “BEFORE the files Get Removed From your Device, Run this Script, THEN Remove the files From the Device.”
These files are executable scripts which are automatically run before or after a package is installed by the . 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 that package will be 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’ script).
This script typically completes any required configuration of the package foo once foo 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 re-configure that 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 foo, and/or removes files created by the package. (Also see What is a Virtual Package?, Section 6.8.)
Currently all of the control files can be found in 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; you should not rely on it.)