File sbd.spec of Package sbd

#
# spec file for package sbd
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 Lars Marowsky-Bree
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           sbd
Summary:        Storage-based death
License:        GPL-2.0+
Group:          Productivity/Clustering/HA
Version:        1.2.1.git.1408100832.f0a4a63
Release:        0
Url:            https://github.com/l-mb/sbd
Source:         %{name}-%{version}.tar.xz
Patch1:         add-explicit-libs.patch
Patch2:         sbd-configure-libcoroipcc.patch
Patch3:         sbd-pacemaker.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  e2fsprogs-devel
BuildRequires:  glib2-devel
BuildRequires:  libaio-devel
BuildRequires:  libcorosync-devel
BuildRequires:  libglue-devel
BuildRequires:  libpacemaker-devel
BuildRequires:  libtool
BuildRequires:  libuuid-devel
BuildRequires:  libxml2-devel
BuildRequires:  pkgconfig
BuildRequires:  python-devel
Conflicts:      ClusterTools2 < 2.3.2
Requires(pre):  %fillup_prereq

%if %{defined systemd_requires}
%systemd_requires
%endif

%description

This package contains the storage-based death functionality.

%prep
###########################################################
# %setup -n sbd-%{version} -q
%setup
%patch1 -p1
%patch2 -p1
%patch3 -p1
###########################################################

%build
autoreconf -i
export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror"
%configure
make %{?_smp_mflags}
###########################################################

%install
###########################################################
make DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} install
install -D -m 0755 src/sbd.sh $RPM_BUILD_ROOT/usr/share/sbd/sbd.sh
%if %{defined _unitdir}
install -D -m 0644 src/sbd.service $RPM_BUILD_ROOT/%{_unitdir}/sbd.service
%endif
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
cp -f src/sbd.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.sbd

%clean
###########################################################
if
  [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]
then
  rm -rf $RPM_BUILD_ROOT || true
fi

%if %{defined _unitdir}
%post
%service_add_post sbd.service

if [ ! -e %{_sysconfdir}/sysconfig/sbd ]; then
    %fillup_only sbd
fi

%pre
%service_add_pre sbd.service

%preun
%service_del_preun sbd.service

%postun
%service_del_postun sbd.service
%endif

%files
###########################################################
%defattr(-,root,root)
%{_libdir}/stonith/plugins/external/sbd
%{_sbindir}/sbd
%{_datadir}/sbd
%doc %{_mandir}/man8/sbd*
%if %{defined _unitdir}
%{_unitdir}/sbd.service
%endif
%{_localstatedir}/adm/fillup-templates/sysconfig.sbd
%doc COPYING

%changelog
openSUSE Build Service is sponsored by