Re: use %pre section of .rpm file to check if this package is already installed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 January 2016 at 16:39, Dmytro Shyshchenko <shyschenko@xxxxxxxxx> wrote:
> One rpm .spec file was developed long time ago and the %pre section of
> it was used to check if a previous major version of this software is
> already installed or not. And it did work before. I saw it personally.
> In the rpm 4.8 (rhel 6.5-6.7), this does not work anymore. During
> installation the rpm installer does not reach (or ignore?) the %pre
> section and complains that "file ... from install of
> our-software-23.01.el6.i386 conflicts with file from package
> our-software-22.07.el6.i386" and then the installation aborts.
>
> I have posted the same question also on the unix.stackexchange.com:
> http://unix.stackexchange.com/questions/254883/pre-section-of-my-rpm-is-no-longer-executed-on-rhel-6-7
>
> Is there a way to make it work or the check is supposed be done
> different? Any help is much appreciated! Thank you in advance.

First using %pre for checks is usually an abuse.
Usually checks in %pre are best handled with requires/conflicts/...
tags instead.

Then the error you see is because you should have uses "rpm -Uvh"
instead of "rpm -ivh"
%pre is executed when running the transaction before actually
installing the package

But in order to reach this stage, rpm first checks the transaction for problems.
File conflicts is such a problem and will abort the transaction before
being able to run %pre.

If instead of doing an upgrade, you try to install the new version (so
that it coexist with the old version), then there's a conflict between
the two packages are they provide the same file but with a different
content, a different checksum, a different date, ...

So either do an upgrade (rpm -U) or ensure both versions of your
package can coexist (by using different pathes)

I see on the link you provided you uses %pre for displaying a warning
about unsupported upgrades.
If you use the proper command (rpm -U) then your %pre would be run and
would abort the transaction with your message.

See you
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux