I need an RPM built for a specific minor version of RH, so that it only installs on that minor version (ex RHEL 6.4) and not on other minor versions like RHEL 6.6.

Also when rpm/yum installs this pkg on a platform it was not meant for (RHEL 6.6 in the example above), the installation should continue for the rest of the pkgs to install.

I looked over /usr/lib/rpm/rpmrc but I could not find anything that I can use.


With the rpm %pre script (see http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html) you can check the system before the rpm installation (for exemple the /etc/redhat-release file). But I do not think you can do more than make the installation fail.

A possible way to just skip installation on unwanted system is to build the rpm in a way that the installed files are put in a temporary folder. Then the %post installation script can check the system version and if needed copy the file to the right location. You'll have to make sure that the un-installation also behave correctly by using the %preun or %postun scripts.

| improve this answer | |

You could put a Requires: for your redhat-release package, with a specific version, say, 6.4.

I'd check all the metadata for the redhat-release RPM, and see what's appropriate

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.