Can I make an rpm abort installation in a %post script?

alicewonder at alicewonder at
Wed Oct 1 21:06:31 UTC 2014

> Hi all.
> I basically want to add a regression test to my spec file's %post script
> and have the rpm uninstall itself if the %post script fails.
> If my %post script exits non-zero, I get a non-fatal POST error.
> Is there a way to make %post give a fatal error?
> Thanks!

I don't believe there is. %post is not necessarily run directly after your
package installs in cases where numerous packages are installed at once.

So if package A uninstalls in %post because of a failure, package B
requires package A, but package A's post script isn't executed until after
B is installed - that could be problematic.

Better to use Requires to make sure your RPM has everything it needs to
not fail its %post scriptlet.

More information about the Rpm-list mailing list