File resource-agents.spec of Package resource-agents

# spec file for package resource-agents
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# 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

Name:           resource-agents
Version:        4.2.0+git63.0f7987fb
Release:        0
Summary:        HA Reusable Cluster Resource Scripts
License:        GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
Group:          Productivity/Clustering/HA
Source:         resource-agents-%{version}.tar.xz
Source1:        resource-agents.conf
Source2:        monitoring-plugins-metadata.tar.bz2

# PATCH-FIX-OPENSUSE: activate VG with partial PV by default
Patch1:         0001-LVM-Default-partial_activation-to-true-in-SLE-HAE.patch
# PATCH-FIX-OPENSUSE: fix path to sm-notify
Patch2:         0002-nfsserver-fix-path-to-sm-notify.patch
# PATCH-FIX-OPENSUSE: ldirectord: don't create subsys lock
Patch3:         0003-ldirectord-don-t-create-subsys-lock.patch
# PATCH-FIX-OPENSUSE: Revert moving binaries to /usr/libexec
Patch4:         0004-Revert-Low-build-Move-binaries-in-usr-lib-heartbeat-.patch
# PATCH-FIX-OPENSUSE: Revert ocf_log: use same log format at pacemaker
Patch6:         0006-Revert-ocf_log-use-same-log-format-as-pacemaker.patch
# bsc#1114855
Patch7:         0007-LVM-activate-return-OCF_NOT_RUNNING-on-initial-probe.patch

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_4
BuildRequires:  libglue-devel
BuildRequires:  libxslt
BuildRequires:  pkgconfig
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(glib-2.0)
Requires:       /usr/bin/logger
Obsoletes:      heartbeat-resources
Provides:       %{name}-devel = %{version}
Provides:       heartbeat-resources
# Merging the aws-vpc-move-ip package as the upstream RA will be adopted.
Provides:       aws-vpc-move-ip = 0.2.20171113
Obsoletes:      aws-vpc-move-ip <= 0.2.20171113
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

A set of scripts to interface with several services to operate in a
High Availability environment for both Pacemaker and rgmanager
service managers.

%package -n ldirectord
Summary:        A Monitoring Daemon for Maintaining High Availability Resources
License:        GPL-2.0-only AND LGPL-2.1-or-later
Group:          Productivity/Clustering/HA
Requires:       %{name}
Requires:       ipvsadm
Requires:       logrotate
Requires:       perl-IO-Socket-INET6
Requires:       perl-MailTools
Requires:       perl-Net-SSLeay
Requires:       perl-Socket6
Requires:       perl-libwww-perl
Obsoletes:      heartbeat-ldirectord
Provides:       heartbeat-ldirectord

%description -n ldirectord
ldirectord is a stand-alone daemon for monitoring the services on real
servers. Currently, HTTP, HTTPS, and FTP services are supported.
ldirectord works with the heartbeat code (

See `ldirectord -h` and linux-ha/doc/ldirectord for more information.

%package -n monitoring-plugins-metadata
Summary:        Metadata for Monitoring plugins
License:        LGPL-2.1-or-later AND GPL-2.0-or-later
Group:          Productivity/Clustering/HA
Requires:       monitoring-plugins-fping
Requires:       monitoring-plugins-http
Requires:       monitoring-plugins-ldap
Requires:       monitoring-plugins-mysql
Requires:       monitoring-plugins-pgsql
Requires:       monitoring-plugins-tcp
Requires:       resource-agents
Provides:       nagios-plugins-metadata
BuildArch:      noarch

%description -n monitoring-plugins-metadata
XML files containing metadata which facilitates using nagios
plugins as resource agents. These files were produced from help
pages of individual nagios plugins.

%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1

autoreconf -fvi
# because quilt push changed the permissions of  sg_persist.
# chmod 775 heartbeat/sg_persist
%configure \
    --docdir=%{_defaultdocdir}/%{name} \
    --with-ras-set=linux-ha \
    --enable-fatal-warnings=no \
    --enable-libnet=no \
    --with-systemdsystemunitdir=%{_unitdir} \ \
    --with-pkg-name=%{name} \
make %{?_smp_mflags}

mkdir -p %{buildroot}%{_sysconfdir}/ha.d/resource.d
ln -s service %{buildroot}/%{_sbindir}/rcldirectord
# Dont package static libs
find %{buildroot} -type f -name "*.la" -delete -print
# Unset execute permissions from things that shouln't have it
find %{buildroot} "(" -name "ocf-*" -o -name "*.dtd" ")" -type f -exec chmod a-x "{}" "+"
chmod 0755 %{buildroot}%{_sbindir}/ocf-tester
chmod 0755 %{buildroot}%{_sbindir}/ocft
mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
install -m 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/tmpfiles.d
cd %{buildroot}/%{_libdir}/heartbeat
for f in ocf-returncodes ocf-shellfuncs
    ln -s %{_libexecdir}/ocf/lib/heartbeat/$f

# install nagios plugins XML metadata
tar -xjf %{SOURCE2}
mkdir -p %{buildroot}%{_datadir}/nagios/plugins-metadata
for file in $(find plugins-metadata -type f); do
	install -m 644 $file %{buildroot}%{_datadir}/nagios/plugins-metadata

# Create a symlink for backward compat of suse:aws-vpc-move-ip 
mkdir -p %{buildroot}%{_libexecdir}/ocf/resource.d/suse
cd %{buildroot}%{_libexecdir}/ocf/resource.d/suse
ln -s %{_libexecdir}/ocf/resource.d/heartbeat/aws-vpc-move-ip aws-vpc-move-ip

%tmpfiles_create %_tmpfilesdir/resource-agents.conf




%preun -n ldirectord
%service_del_preun ldirectord.service

%postun -n ldirectord
%service_del_postun ldirectord.service

%post -n ldirectord
%service_add_post ldirectord.service

%pre -n ldirectord
%service_add_pre ldirectord.service

%dir %{_prefix}/lib/ocf
%dir %{_prefix}/lib/ocf/resource.d
%dir %{_prefix}/lib/ocf/lib
%dir %{_prefix}/lib/tmpfiles.d
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/ocft
%dir %{_datadir}/%{name}/ocft/configs
%config(noreplace) %{_datadir}/%{name}/ocft/configs/*
%ghost %dir %attr (1755, root, root) %{_rundir}/resource-agents
%license COPYING
%license COPYING.GPLv3
%doc %{_datadir}/%{name}/ra-api-1.dtd
%doc doc/README.webapps
# For compatability with pre-existing agents
%dir %{_sysconfdir}/ha.d
%config %{_sysconfdir}/ha.d/shellfuncs
%dir %{_libdir}/heartbeat

%files -n ldirectord
%doc ldirectord/
%dir %{_sysconfdir}/ha.d/resource.d
%exclude %{_sysconfdir}/init.d/ldirectord
%config(noreplace) %{_sysconfdir}/logrotate.d/ldirectord

%files -n monitoring-plugins-metadata
%dir %{_datadir}/nagios
%dir %{_datadir}/nagios/plugins-metadata
%attr(0644,root,root) %{_datadir}/nagios/plugins-metadata/*