Bug#229715: apt: Add a "postinst command spool"
Agustin Martin Domingo <firstname.lastname@example.org> writes:
> 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.
I think the texhash package should provide the hook and each package
could call "dpkg-hook --activate texhash <calling package>" or
something. The hook provided could be any binary (usually shell
script) and gets the list of packages (<calling package> argument)
invoking it. dpkg-hook or dpkg --activate-hook or something could be
used. The first has the advantage that it can be written easily and
seperate from dpkg but it wouldn't run the hooks synchron after dpkg
is done and errors couldn't be reported.