Red Hat Bugzilla – Bug 56521
RFE: run-once pre/post scripts.
Last modified: 2007-11-30 17:10:30 EST
Currently, when I upgrade, for example, 6 mozilla packages (mozilla,
mozilla-mail, mozilla-psm, etc), the ldconfig and rebuild-databases.sh will
be ran *twelwe* times (6 %postun scripts and 6 %post scripts). It would be
nice if rpm would have a feature that would allow packagers to specify that
a certain script has to be ran only once per rpm invocation, even if a
bunch of packages reqest it. Obviously, not only mozilla packages would
benefit from it...
Yup, well understood. In fact, running /sbin/ldconfig in %post
and %postun for each and every package that has a shared
library during an upgrade is more than a bit dumb. I'm willing to
wager that running ldconfig is at least 15% of the wall clock time
of an upgrade. Any takers?
However, since this can't be changed in rpm alone, each and
every package in the distro is gonna need to change, I'm going
to mark this as deferred, as I can't solve the problem in rpm alone.
Yeah, ldconfig is probably the biggest one of all. Especially on upgrade where
all kinds of post and postun scripts call it. I would imagine that solving this
has chances to reduce the upgrade time quite dramatically.
Would the following approach make sense:
- rpm would provide a script /sbin/rpm-run-once such that whenever a package calls
/sbin/rpm-run-once prog args
it would remember it and than run
at some later point. Of cource, that "some later point" is tricky - if a package
runs something right away (w/o using the rpm-run-once) in a pre script, we need
to make sure all the post scripts for its pre-dependencies have been already
I guess this means that the post scripts should be ran in batches (delayed until
the first pre script that cares about those). In each batch the first invocation
of "/sbin/rpm-run-once prog args" would just run the "prog args" right away and
then the subsequent calls (with the same prog and args) withing the same batch
would just be ignored.
A cute thing is that we can just start with a dummy implementation -
rpm-run-once would just exec prog args right away. Does not give any advantage
except give people the chance to start converting to new /sbin/rpm-run-once. Can
also be used for legacy rpm versions, once the real thing is there in the new
A specific ldconfig optimisation is available in rpm.