John Rocha John Rocha - 6 months ago 32
Linux Question

How to prevent a SUSE RPM from installing on a RedHat system

We have a product that is distributed via RPMs. We create both SUSE SLES10 SP1 RPMs and RedHat 5.5 RPMs. There are differences between the two, things will not work correctly (often mysteriosly) if you install a SUSE RPM on a RedHat machine and vice versa.

Is there a way to prevent a RedHay RPM from being installed on a SUSE system and vice versa? I googled around for this and found but all the constraints here seem to be based on the output from the command

which doesn't tell you if you're running RedHat or Suse. The os is Linux, and the architecture is the same.

We have ideas to add checks in the install script that can look for 'Red Hat' or 'SUSE' in the /etc/issue file but I'm really hoping there is a better option than this.


Since you're specifically just looking to detect RedHat, look for the presence of a file named /etc/redhat-release. If it's there, you're installing on some version of RedHat.