On Thu, Aug 02, 2012 at 12:41:49PM -0600, Dmitry Makovey wrote:
I'm working on bringing pgpool-II packages
(postgresql-pgpool-II-3.1.2-1) from
Fedora over to RHEL6. I've already "hacked" Fedora version to play nice
with
RHEL (removing systemd references and supplanting systemd unit with init
script). I have also conditionalized it to build either one depending on
whether systemd is to be used or not using the
%if %{systemd_enabled}
...
%else
...
%endif
blocks. However I can't quite figure out an optimal way of determining which
platform package is being compiled for (in other words: how to set up
systemd_enabled macro automatically rather than rely on manual setup). I'm
sure people on this list came across this problem more than once, and I would
like to know what's the standard way of resolving it. What I'm trying to
achieve is to get one SPEC for both Fedora and RHEL. Am I attacking this
problem the wrong way?
I would suggest to do it the following way:
%if 0%{?rhel} && 0%{?rhel} <= 6
%define systemd_enabled 0
%else
%define systemd_enabled 1
%endif
This is the way I do it in my backports (e.g. PostgreSQL 9.x for RHEL 6.x).
--
-- Jos Vos <jos(a)xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204