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
URL:           http://clusterlabs.org/
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
%else
BuildRequires: libxslt
BuildRequires: bzip2-devel gnutls-devel
BuildRequires: libtool-ltdl-devel
%endif
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)
%endif
%if 0%{?rhel} >= 7
BuildRequires: python
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}_%{version}%{?extraver}.orig.%{srcext}

%description
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)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
./autogen.sh

%build
%configure \
 --disable-static \
%if 0%{?_unitdir:1}
 --enable-systemd \
%endif
%if 0%{?rhel} == 6
 --enable-upstart \
%endif
 --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}

%install
%{__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*
%else
%{__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
%endif
%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
%endif

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

%files
%defattr(-,root,root)
%doc AUTHORS COPYING COPYING.LIB NEWS README.markdown TODO.markdown
%doc doc/*.txt doc/*.md doc/stonith-ng.conf.example
%config(noreplace) %{_sysconfdir}/logrotate.d/pacemaker
%if 0%{?_unitdir:1}
%{_unitdir}/*.service
%else
%{_initrddir}/*
%endif
%{_sbindir}/*
%{_libdir}/*.so.%{?so_ver}*
%{_datadir}/%{name}/
%dir %{_datadir}/snmp/mibs
%dir %{_datadir}/snmp
%{_datadir}/snmp/mibs/PCMK-MIB.txt
%{python_sitearch}/cts
%{_prefix}/lib/ocf
%{_libexecdir}/pacemaker

# Development stuff
%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*.pc
%{_includedir}/%{name}/
%{_libdir}/*.so
%exclude %{_libdir}/*.la

%if 0%{?suse_version}

%if 0%{?_unitdir:1}

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

%post
/sbin/ldconfig
%{fillup_only pacemaker}
%{service_add_post crm_mon.service}
%{service_add_post pacemaker.service}
%{service_add_post pacemaker_remote.service}

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

%postun
/sbin/ldconfig
%{service_del_postun crm_mon.service}
%{service_del_postun pacemaker.service}
%{service_del_postun pacemaker_remote.service}
%{insserv_cleanup}

%else

%post
/sbin/ldconfig
%if %{?suse_version}%{!?suse_version:9999} < 1230
%{fillup_and_insserv crm_mon}
%{fillup_and_insserv pacemaker}
%{fillup_and_insserv pacemaker_remote}
%endif

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

%postun
/sbin/ldconfig
%{restart_on_update crm_mon}
%{restart_on_update pacemaker}
%{restart_on_update pacemaker_remote}
%{insserv_cleanup}

%endif

%else

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

%endif

%changelog
openSUSE Build Service is sponsored by