prerm
prerm, short for pre-removal, is a Debian/Ubuntu package maintainer script that runs before a package is removed from the system. It is part of the set of dpkg maintainer scripts, which also include preinst, postinst, and postrm. The prerm script is invoked when a package is being removed, upgraded, or otherwise uninstalled, and its main purpose is to perform cleanup and release resources that cannot be safely removed merely by deleting files.
During its execution, prerm is given an argument that indicates the action being performed (for example, removal
Best practices for writing a prerm script include making it idempotent and non-interactive, checking for the
Prerm is complemented by preinst (before installation), postinst (after installation), and postrm (after removal). Together, these