I have several custom .debs that I’ve built. They all depend on apache and after upgrade of any package apache needs to be restarted.
Restarting apache naively from the postinst I get a restart for each package I upgrade, which is really slow. Does anyone know if there’s a good way to avoid that? Dpkg triggers seems to be the right approach but I can’t seem to find much in the way of documentation. Does apache define its own trigger to activate. If so, how do I call it?
Yes, dpkg triggers would be the right approach here. And no, I don’t believe that there is any preexisting trigger-fu to solve this problem for you.
At its most simple, your setup might consist of something like the following:
DEBIAN/triggersfile should contain a line likeinterest apache-coordination-reload.postinstshould handle the case where it gets called with the argument “triggered” and where “apache-coordination-reload” is somewhere in the second argument, by performing the actual apache reload or restart (ideally throughinvoke-rc.dor something similar, so that runlevels are respected).apache-coordination-reloadtrigger when appropriate. This could be done by shippingDEBIAN/triggersfiles for each of them containingactivate apache-coordination-reload.