If you've ever installed a package from command line on Linux, you must have noticed two main prompts related to package configuration: one asking what to do with installed configuration files with local changes, and one providing feedback right after the installation/upgrade/removal/purge has completed.
Under Debian the latter was most probably the postinst script, one of the Package Maintainer Scripts which is executed after installation and configuration.
These diagrams are very useful to understand what happens to the Maintainer Scripts in different circumstances: first installation, upgrade, removal, purge.
Their name is probably self-explanatory: preinst, postinst, prerm, postrm. Each of them takes zero or more arguments depending on the scenario. It can help to understand that those are really just scripts executed by dpkg - and typically they are shell scripts, sometimes with interactive prompts.
If you're building your own packages, you surely already have one of more of those scripts in the source debian/ directory. They are automatically included in the .deb by dpkg-buildpackage (or any of its wrappers) during the build.
What you may find interesting - and this is the purpose of this article - is that if you're building multiple .deb packages from the same debian/ directory (i.e. using the same debian/control makefile), having for example a single postinst script is not sufficient. Only the first built .deb will contain it, while the others won't.
The symptom in this example is that when installing the packages other than the first built, you won't see any of the prompts, feedback or actions you are delegating to postinst.
To fix this, it's sufficient to include for example a postinst script per package:
debian/control
debian/rules
[...]
debian/package_1.postinst
debian/package_2.postinst
debian/package_3.postinst
In case you're wondering, yes, you can have a single postinst script and just create a symbolic link to it for each package.
Subscribe to:
Post Comments (Atom)
Wireshark setting to interpret UDP as RTP automatically
Before I forget again, a Wireshark setting that can help saving time by trying to interpret any UDP as RTP, if possible: Analyze --> Ena...
-
I needed an efficient way to programmatically extract RTP streams from a network capture. In addition I wanted to: save each stream into a s...
-
Before I forget again, a Wireshark setting that can help saving time by trying to interpret any UDP as RTP, if possible: Analyze --> Ena...
-
Docker is an incredibly useful tool to build prototypes of Linux hosts and applications. You can easily build a network of servers inside...
No comments:
Post a Comment