Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rpm scriptlet ordering for install/remove/upgrade using yum

Tags:

scriptlet

rpm

I'm working on a bug in our rpm scriptlets which is probably originating from order in which our scriptlets are executed during package install/removal/upgrade. We are using yum on Redhat Enterprise.

Obviously I first need a good understanding of the order of the rpm scriptlets - and interestingly enough I have not found a good summary of this anywhere.

From what I gather this is the scriptlet ordering for upgrades:

  • %pretrans of new package
  • %pre of new package prein
  • package install
  • %post of new package postin
  • %preun of old package
  • removal of old package
  • %postun of old package
  • %posttrans of new package

However it doesn't list the scriptlet orderings for installing a new package not previously on the system (i.e. not an upgrade) and for removing one? From the above ordering I am able to guess how these orderings might look, but I'd like to get some educated opinion on this as well...

like image 269
fgysin Avatar asked Mar 17 '14 13:03

fgysin


People also ask

What is RPM Scriptlet?

RPM spec files have several sections which allow packages to run code on installation and removal. These bits of code are called scriptlets and are mostly used to update the running system with information from the package.

What is Preun?

%pre of new package. (package install) %post of new package. %preun of old package. (removal of old package)


2 Answers

Package order for installing a single package for the first time:

  • %pretrans of new package
  • %pre of new package
  • package install
  • %post of new package
  • %posttrans of new package

Package order for removing a single package:

  • %preun of old package
  • removal of old package
  • %postun of old package
like image 193
fgysin Avatar answered Sep 27 '22 19:09

fgysin


If you are installing two different packages at once (e.g. primary, secondary ), where one depends on the other (secondary requires primary), the order is:

  • %pretrans of primary
  • %pretrans of secondary
  • %pre of primary
  • installation of primary
  • %post of primary
  • %pre of secondary
  • installation of secondary
  • %post of secondary
  • %posttrans of primary
  • %posttrans of secondary

When removing these packages at once, the order is:

  • %preun of secondary
  • removal of secondary
  • %postun of secondary
  • %preun of primary
  • removal of primary
  • $postun of primary
like image 22
donmarjanus Avatar answered Sep 27 '22 18:09

donmarjanus