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/triggers
file should contain a line like interest apache-coordination-reload
.postinst
should 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 through invoke-rc.d
or something similar, so that runlevels are respected).apache-coordination-reload
trigger when appropriate. This could be done by shipping DEBIAN/triggers
files for each of them containing activate apache-coordination-reload
.