# SPEC file overview:
# https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/#con_rpm-spec-file-overview
# Fedora packaging guidelines:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/

Name:    nagios-plugins-check_raid
Version: 4.0.10
Release: 2.ndias%{?dist}
Summary: Plugin to checks RAID status

License: GPLv2
URL:     https://github.com/glensc/nagios-plugin-check_raid
Source0: https://github.com/glensc/nagios-plugin-check_raid/archive/refs/tags/%{version}.tar.gz#/nagios-plugin-check_raid-%{version}.tar.gz
BuildArch: noarch

BuildRequires: perl-ExtUtils-MakeMaker-CPANfile, make, perl-macros
Requires: perl-Module-Pluggable

%description
This plugin checks all RAID volumes (hardware and software) that can be
identified

%prep
%setup -q -n nagios-plugin-check_raid-%{version}


%build
perl Makefile.PL PREFIX=/usr INSTALLDIRS=perl
make %{?_smp_mflags}


%install
%make_install

rm -f $RPM_BUILD_ROOT/%{perl_archlib}/auto/App/Monitoring/Plugin/CheckRaid/.packlist
rm -f $RPM_BUILD_ROOT/%{perl_archlib}/perllocal.pod
install -d $RPM_BUILD_ROOT/%{_libdir}/nagios/plugins
mv -f $RPM_BUILD_ROOT/%{_bindir}/check_raid.pl $RPM_BUILD_ROOT/%{_libdir}/nagios/plugins
chmod 755 $RPM_BUILD_ROOT/%{_libdir}/nagios/plugins/check_raid.pl

%files
%doc CHANGELOG.md CONTRIBUTING.md README.md
%license

%{_libdir}/nagios/plugins/check_raid.pl

%dir %{perl_archlib}/auto/App/Monitoring/Plugin/CheckRaid
%dir %{perl_privlib}/App/Monitoring/Plugin/CheckRaid/
%dir %{perl_privlib}/App/Monitoring/Plugin/CheckRaid/Plugins

%{perl_privlib}/App/Monitoring/Plugin/CheckRaid.pm
%{perl_privlib}/App/Monitoring/Plugin/CheckRaid/*.pm
%{perl_privlib}/App/Monitoring/Plugin/CheckRaid/Plugins/*.pm

%changelog
* Thu Jan 11 2024 Nuno Dias <Nuno.Dias@gmail.com> - 4.0.10-2.ndias
- Change INSTALLDIRS=perl and add Requires

* Fri Oct 13 2023 Nuno Dias <Nuno.Dias@gmail.com> - 4.0.10-1.ndias
- Version 4.0.10