As the subject reads, I wonder whether it is possible in the RPM spec file to make required packages dependent on a condition?
For instance check in a shell statement if on the install target e.g. the host is using bonding interfaces and only if have the Require become effective.
No. You can hand modify the
Requires
line and turn off autodetection, and then handle what is optional as needed.As an answer to your original question - Yes this is possible, but what you can implement depends what you want to use as a condition, and those are written to the package during build-time of the package, not during installation. You could easily do something in the .spec like
Question is, how much sense does that make, and what is your particular use case?
For what you described, that is not possible in that way, as you cannot change the package during install-time. You have a few options for your scenario:
%pre/%post
script, so that it only runs conditionally.For more details on conditional/dynamic macros which are mostly available since rpm.org v4.12 see http://www.rpm.org/wiki/DynamicDependencies
For more details on the
%pre/%post
and other scriptlets see e.g. https://fedoraproject.org/wiki/Packaging:ScriptletSnippets