Bug#229715: apt: Add a "postinst command spool"
Goswin von Brederlow wrote:
Scheduling something to be run just once in an install/upgrade session
is quite complicated currently. A clean and common mechanism for it
would be nice. I was looking for that just last week.
I was thinking about something for the LaTeX packages, where texhash or
its equivalent is run by each package postinst, when running it once at
the very end would be enough
An quick, unsafe and dirty approach:
echo "texhash" > /var/lib/dpkg/hooks/texhash.postinst
for each package requiring the TeX database to be updated.
dpkg doing, after running maintainer scripts, something like
$postinst_hooks=the list of postinst hooks
for i in $postinst_hooks; do
sh $i && rm $i
To be safer not everything should be allowed as a hook, having
pre-defined hooks somewhere and allowing only to run them, and probably
many other things should be done to make it really work.