File pacemaker.spec of Package pacemaker

%define realname pacemaker
%define srcext   tar.gz

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       1.1.15
Release:       %{?extraver:0.}1%{?dist}
License:       GPL-2.0 and LGPL-2.1
Group:         Productivity/Clustering/HA
Summary:       Open Source, High Availability clusrer resource manager

# Install-time parameters
Requires:      logrotate
Requires:      corosync

# Build-time parameters
BuildRequires: libcorosync-devel
BuildRequires: autoconf automake libtool
BuildRequires: flex bison gettext
BuildRequires: pkg-config
BuildRequires: openssl-devel
%if 0%{?suse_version}
BuildRequires: fdupes
BuildRequires: libxslt-tools
BuildRequires: libbz2-devel libgnutls-devel
BuildRequires: libxslt
BuildRequires: bzip2-devel gnutls-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: libxml2-devel libxslt-devel pam-devel libuuid-devel
BuildRequires: ncurses-devel libesmtp-devel
BuildRequires: pkgconfig(glib-2.0) pkgconfig(gio-2.0) pkgconfig(libqb) >= 0.13
BuildRequires: pkgconfig(libcpg) pkgconfig(libcfg)
BuildRequires: pkgconfig(dbus-1)
###BuildRequires: pkgconfig(OpenIPMI) pkgconfig(OpenIPMIposix) pkgconfig(servicelog-1)
BuildRequires: net-snmp-devel
%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7
BuildRequires: pkgconfig(systemd)
%if 0%{?rhel} >= 7
BuildRequires: python
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}_%{version}%{?extraver}.orig.%{srcext}

Pacemaker is a cluster resource manager.

It achieves maximum availability for your cluster services (aka. resources)
by detecting and recovering from node and resource-level failures by making use
of the messaging and membership capabilities provided by your preferred cluster
infrastructure (either OpenAIS or Heartbeat).

It can do this for clusters of practically any size and comes with a powerful dependency model that allows the administrator to accurately express the relationships (both ordering and location) between the cluster resources.

Virtually anything that can be scripted can be managed as part of a Pacemaker cluster.

%package devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}

%description devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%setup -q -n %{realname}-%{version}%{?extraver}

%configure \
 --disable-static \
%if 0%{?_unitdir:1}
 --enable-systemd \
%if 0%{?rhel} == 6
 --enable-upstart \
 --with-corosync \
 --with-cs-quorum \
 --with-nagios \
 --with-nagios-plugin-dir=%{_libdir}/nagios \
 --with-snmp \
 --with-esmtp \
 --with-acl \
 --with-cibsecrets \
 --with-initdir=%{_initrddir} \
 CFLAGS="%{optflags}" \
 CXXFLAGS="%{optflags}" \
 LDFLAGS="%{!?suse_version:-ltinfo }-Wl,--as-needed -Wl,--strip-all"
%{__make} %{?_smp_mflags}

%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc
%{__chmod} a-x %{buildroot}%{_datadir}/%{name}/*.{rng,xsl,dtd}
%if 0%{?_unitdir:1}
%{__rm} -f %{buildroot}%{_initrddir}/pacemaker*
%{__sed} -ri '/Should-Start/ a\# Should-Stop:' %{buildroot}%{_initrddir}/*
%{__sed} -ri 's/Should-Stop:/&\t\t\$null/'     %{buildroot}%{_initrddir}/*
%{__sed} -ri '/Default-Start/ s/:/: 2 3 5/'    %{buildroot}%{_initrddir}/pacemaker
%{__sed} -ri '/Default-Start/ s/:/: 2 3 5/'    %{buildroot}%{_initrddir}/pacemaker_remote
%if %{expand:%_vendor == "suse"}
[ -x %{buildroot}%{_initrddir}/pacemaker ]        && \
  %{__ln_s} %{_initrddir}/pacemaker        %{buildroot}%{_sbindir}/rcpacemaker
[ -x %{buildroot}%{_initrddir}/pacemaker_remote ] && \
  %{__ln_s} %{_initrddir}/pacemaker_remote %{buildroot}%{_sbindir}/rcpacemaker_remote
%fdupes %{buildroot}%{_datadir}
[ "%{buildroot}" != "/" ] && find %{buildroot}%{python_sitearch}/cts -name "*.pyc" -or -name "*.pyo" -delete

[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%doc doc/*.txt doc/*.md doc/stonith-ng.conf.example
%config(noreplace) %{_sysconfdir}/logrotate.d/pacemaker
%if 0%{?_unitdir:1}
%dir %{_datadir}/snmp/mibs
%dir %{_datadir}/snmp

# Development stuff
%files devel
%exclude %{_libdir}/*.la

%if 0%{?suse_version}

%if 0%{?_unitdir:1}

%{service_add_pre crm_mon.service}
%{service_add_pre pacemaker.service}
%{service_add_pre pacemaker_remote.service}

%{fillup_only pacemaker}
%{service_add_post crm_mon.service}
%{service_add_post pacemaker.service}
%{service_add_post pacemaker_remote.service}

%{service_del_preun crm_mon.service}
%{service_del_preun pacemaker.service}
%{service_del_preun pacemaker_remote.service}

%{service_del_postun crm_mon.service}
%{service_del_postun pacemaker.service}
%{service_del_postun pacemaker_remote.service}


%if %{?suse_version}%{!?suse_version:9999} < 1230
%{fillup_and_insserv crm_mon}
%{fillup_and_insserv pacemaker}
%{fillup_and_insserv pacemaker_remote}

%{stop_on_removal crm_mon}
%{stop_on_removal pacemaker}
%{stop_on_removal pacemaker_remote}

%{restart_on_update crm_mon}
%{restart_on_update pacemaker}
%{restart_on_update pacemaker_remote}



%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig


openSUSE Build Service is sponsored by