Search code examples
rpmrpmbuildrpm-spec

RPM upgrade post install exit


Is there a way to exit from %post section in case of a upgrade RPM.

I have simple rpm with following sections. NOTE: here I have exit in %post.

When I run rpm -Uvh package_name, there is an error encountered in %post section. The exit does happen only from %post section. However the rpm then continues with %preun and %postun section.

I just want to exit if there are any error in %post section. Can this be achieved?

  %pre
  perform few checks here

  %post
  perform upgrade steps.
  If there is a error performing upgrade steps. **Then exit**

  %preun
  Perform pre-uninstall checks


  %postun
  Perform un-installation steps of previous package

Can someone clarify on this upgrade rpm package.


Solution

  • Atul.

    I guess, you cannot abort rpm transaction in %post script let (script let exit codes are ignored by RPM).