File sbd.spec of Package sbd.10478

#
# spec file for package sbd
#
# Copyright (c) 2019 SUSE LINUX 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-or-later
Group:          Productivity/Clustering/HA
Version:        1.2.1
Release:        0
Url:            https://github.com/l-mb/sbd
Source:         sbd-%{version}.tar.bz2
Source1:        sbd_remote.service
Patch1:         add-explicit-libs.patch
Patch2:         sbd-configure-libcoroipcc.patch
Patch3:         sbd-pacemaker.patch
Patch4:         bug-950415_sbd-pacemaker-segfault.patch
Patch5:         bug-993032_sbd-man-pcmk_delay_max.patch
Patch6:         bsc#1033934-0001-Low-sbd.sh-consistent-use-of-SBD_BIN.patch
Patch7:         bsc#1033934-0001-Fix-sbd.sh-Correctly-handle-SBD_DELAY_START-for-mult.patch
Patch8:         bsc#1033934-0001-Fix-sbd-inquisitor-Correctly-look-up-servant-by-devi.patch
Patch9:         bsc#1033934-0002-Fix-sbd-inquisitor-Do-not-create-duplicate-servants.patch
Patch10:        bsc#1033934-0003-Refactor-sbd.sh-Use-a-more-obvious-variable-on-parsi.patch
Patch11:        0001-Fix-node-name-parameter-in-manpage.patch
Patch12:        bsc#1033600-0001-Doc-man-Call-P-option-Pacemaker-integration-in-the-d.patch
Patch13:        bsc#1074038-0001-Doc-sbd.sysconfig-mention-timeout-caveat-with-SBD_DE.patch
Patch14:        bsc#1079316-0001-sbd-md-dump_headers-returns-0-even-open_device-faile.patch
Patch15:        0001-Fix-add-Documentation-value-to-systemd-services.patch
Patch16:        bsc#1086650-0001-Fix-sbd-md-return-error-if-faied-to-list-any-devices.patch
Patch17:        bsc#1112918-0001-Doc-sbd.8.pod-use-the-generic-term-cluster-services-.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
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -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
install -D -m 0644 %{S:1} $RPM_BUILD_ROOT/%{_unitdir}/sbd_remote.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 sbd_remote.service

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

%pre
%service_add_pre sbd.service sbd_remote.service

%preun
%service_del_preun -n sbd.service sbd_remote.service

%postun
%service_del_postun -n sbd.service sbd_remote.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
%{_unitdir}/sbd_remote.service
%endif
%{_localstatedir}/adm/fillup-templates/sysconfig.sbd
%doc COPYING

%changelog
openSUSE Build Service is sponsored by