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

Eran Ben Natan eranb at celltick.com
Thu Oct 2 08:15:31 UTC 2014


Hi Dylan,

When %post is running, the package is already installed, so all files are in place. Exiting with fatal error won't help here.
I don't think you can run rpm -e within the %post, because RPM won't allow this.
I believe your only way is to fire a trigger to uninstall the package later (with at command, for example)

If you want to uninstall the package so that packages depends on it will not be installed when using YUM, then you can't, because YUM install all RPMs as a single transaction. In this case you must check in the %pre of the depends package that the %post of the previous package completed successfully.

From: Rpm-list [mailto:rpm-list-bounces at lists.rpm.org] On Behalf Of Dylan Martin
Sent: Wednesday, October 01, 2014 9:06 PM
To: rpm-list at lists.rpm.org
Subject: Can I make an rpm abort installation in a %post script?

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!

-Dylan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20141002/2e06c0ca/attachment.html>


More information about the Rpm-list mailing list