File monitoring-plugins-redfish.spec of Package monitoring-plugins-redfish

#
# spec file for package monitoring-plugins-redfish
#
# Copyright (c) 2020-2021, Martin Hauke <mardnh@gmx.de>
#
# 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/
#


%define realname check_redfish
Name:           monitoring-plugins-redfish
Version:        1.3.0
Release:        0
Summary:        An Icinga plugin to monitor HW-health status via Redfish
License:        MIT
Group:          System/Monitoring
URL:            https://github.com/bb-Ricardo/check_redfish
Source:         https://github.com/bb-Ricardo/check_redfish/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  nagios-rpm-macros
Requires:       python3-redfish >= 2.1.4
BuildArch:      noarch

%description
A monitoring plugin to check components and health status of systems
which support Redfish.

%prep
%setup -q -n %{realname}-%{version}
sed -i 's|/usr/bin/env python3|/usr/bin/python3|g' check_redfish.py

%build

%install
install -d %{buildroot}/%{nagios_plugindir}/check_redfish/
install -m0755 check_redfish.py %{buildroot}/%{nagios_plugindir}/check_redfish/check_redfish
mv cr_module/ %{buildroot}/%{nagios_plugindir}/check_redfish/

%post
mkdir -p %{_localstatedir}/adm/update-messages
cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify <<-'EOF'
With %{name}-%{version} the nagios plugin excecutable path has changed:
  from: %{nagios_plugindir}/check_redfish
  to:   %{nagios_plugindir}/check_redfish/check_redfish
EOF

%postun
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify

%files
%license LICENSE.txt
%doc README.md
%doc contrib/*.conf
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_redfish

%changelog
openSUSE Build Service is sponsored by