0

To give some context, I try to verify the versions of two packages and compare them. If, for example, the server version is lower than its dependencies and not in the transaction being upgraded, I would like to shut down the upgrade. The problem is that I cannot fetch the server version in the pre-section.

I have already tried to use these in the pre part

  • rpm -qa "server" -> This gives the already installed version so if the server is also part of the upgrade transaction it will show the old version in the pre code.
  • rpm -q --qf '%VERSION' --whatprovides server 2>/dev/null -> This gives the target package version that is being installed by rpm, but the problem is that it also gives the target version even if the server will not be installed so it is not part of this transaction.
  • rpm -q --last server | head -n 1 -> This provides the already installed version so the same problem as with the first one.

Is there any further idea on how to verify if the server is also being upgraded (please note that I need to do it before the upgrade happens so in the pre code) to the target version? Any help is appreciated. Thanks.

1 Answer 1

0

You cannot do that in %pre. However, you can come up with solutions that "mostly" or "almost" work.

The correct solution is to specify the dependency in the preamble section (the header).

Either by:

Requires: server > 2.1

or

Conflicts: server < 1.3

You can find more details in rpm documentation: https://rpm-software-management.github.io/rpm/manual/dependencies.html

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.