Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 http://www.rpm.org/max-rpm/ch-rpm-multi.html but all the constraints here seem to be based on the output from the command uname 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.

like image 847
John Rocha Avatar asked Nov 13 '22 16:11

John Rocha


1 Answers

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.

like image 119
Ernest Friedman-Hill Avatar answered Nov 17 '22 06:11

Ernest Friedman-Hill