RPM Spec file conditional Requires per distribution AFTER build

前提是你 提交于 2021-01-27 10:41:31

问题


I want to build RPM files and I want them to be commonly used and beeing not depending on which distribution is installed. Now I found a requirement which name is different on RHEL and SLES. I found this as possible solution:

%if 0%{?suse_version}
 Requires:       jdk >= 2000:1.8.0_00-fcs, netcat, telnet, at
%else
 Requires:       jdk >= 2000:1.8.0_00-fcs, nc, telnet, at
%endif

But my problem with is, that it's an if query for the Build process, what I wish to have is depending on the distribution I install, the already build rpm file would solve this. Because with this solution, I would need to build RPM files for every kind of centos and rhel and sles distribution on all these different OSes while only the name of nc and netcat differ as Required packages.

Any idea how I can do that?

Thanks


回答1:


You cannot do what you are asking at install-time. However, you can require the executable itself, e.g. /bin/netcat and it should work... unless it was part of the great UsrMove...




回答2:


rpm-4.13 will solve my issue: http://www.rpm.org/wiki/PackagerDocs/BooleanDependencies

or - requires one of the operands to be fulfilled
Requires: (pkgA >= 3.2 or pkgB)


来源:https://stackoverflow.com/questions/37007873/rpm-spec-file-conditional-requires-per-distribution-after-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!