On 12/02/2014 06:55 PM, Eran Ben Natan wrote:
That is exactly the purpose of the %pre – to verify that all
prerequisites are met, so, yes, this is a good idea.
That is what dependencies are for. Doing such checks in %pre is
generally speaking a bad idea. And no, that is not what %pre exists
for. Not at all!
*From:*Rpm-list [mailto:rpm-list-bounces@xxxxxxxxxxxxx] *On Behalf Of *doc
*Sent:* Tuesday, December 02, 2014 6:52 PM
*To:* rpm-list@xxxxxxxxxxxxx
*Subject:* %pre scripts with a non-zero exit status.
I'm being asked to create a %pre scriptlet which if certain
configuration conditions are not met will not install the rpm package.
Is this a good idea?
My understanding of rpm scriptlets is that they should always (except
under extreme conditions) exit with a status of 0. Needless to say,
these rpms with the %pre failures would be installed by rpm, yum and
zypper.
Indeed.
%pre (and %pretrans in newer rpm versions) has the capability to cancel
out package installation, %preun similarly can cancel uninstall. Doing
so is almost always a terrible idea however, because the scriptlets are
executed at a point where its not possible to cancel other packages. So
when you're using %pre to cancel package installation, you're pulling
the carpet underneath everything else in the same transaction: your
package does not know what other packages might depend on it.
Non-zero exit from %pre/%preun should be a last-gasp measure for
preventing install. Its basically okay if you know the package will
ALWAYS be installed alone in a transaction, but there's usually no way
to guarantee such a thing.
- Panu -
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list