Test for redhatness (when building RPM's)
Paul Howarth
paul at city-fan.org
Fri Aug 19 18:07:12 UTC 2005
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.
More information about the fedora-list
mailing list