Re: Test for redhatness (when building RPM's)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Prindeville wrote:
I'm trying to tweak a package so that it autodetects when it's being
built under Redhat/Fedora (et al) and does the right thing.

Is there a simple and foolproof test for this?

How about something like this:

%define redhat %(/bin/grep "^Red Hat " /etc/redhat-release &> /dev/null && echo 1 || echo 0) %define fedora %(/bin/grep "^Fedora " /etc/redhat-release &> /dev/null && echo 1 || echo 0)

...

%if %{redhat}
echo Building on RedHat
%else
echo Not building on RedHat
%endif

%if %{fedora}
echo Building on Fedora
%else
echo Not building on Fedora
%endif

%if %{redhat} || %{fedora}
echo Building on RedHat or Fedora
%else
echo Not building on RedHat or Fedora
%endif

Paul.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux