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.