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

#
# spec file for package monitoring-plugins-pdns
#
# Copyright (c) 2017 SUSE LINUX Products 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 http://bugs.opensuse.org/
#

Name:           monitoring-plugins-pdns
Version:        0~git73
Release:        0
License:        GPL-3.0+
Summary:        Monitor PowerDNS
Url:            https://github.com/Finn10111/nagios-plugins/tree/master/check_pdns
Group:          System/Monitoring
Source0:        check_pdns.py
Source1:        check_pdns.php
Source2:        COPYING
Source3:        monitoring-plugins-pdns-rpmlintrc
Patch0:         check_pdns.patch
BuildRequires:  nagios-rpm-macros
Requires:       sudo
Requires:       pdns
Requires:       pnp4nagios
Requires:       python
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Nagios plugin for monitoring PowerDNS. 

%prep
#
%build
#
%install
install -D -m755 %{SOURCE0} %buildroot/%{nagios_plugindir}/check_pdns.py
patch %buildroot/%{nagios_plugindir}/check_pdns.py %{PATCH0}
install -Dp -m 0644 %{SOURCE1} %{buildroot}%{pnp4nagios_templatedir}/check_pdns.php
install -Dp -m 0644 %{SOURCE2} %{buildroot}%{_defaultdocdir}/%{name}/COPYING
install -d -m 755 %{buildroot}%{_sysconfdir}/sudoers.d
cat >> %{buildroot}%{_sysconfdir}/sudoers.d/%{name} << EOF
# Needed for %{name} - to gather statistics for the monitoring
Defaults:%{nagios_user} !requiretty
%{nagios_user} ALL=NOPASSWD: %{_bindir}/pdns_control
EOF

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%dir %{_defaultdocdir}/%{name}
%dir %{_sysconfdir}/sudoers.d
%doc %{_defaultdocdir}/%{name}/COPYING
%config(noreplace) %attr(0400,root,root) %{_sysconfdir}/sudoers.d/%{name}
# avoid build dependecy of nagios - own the dirs
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%dir %{pnp4nagios_datadir}
%dir %{pnp4nagios_templatedir}
%{nagios_plugindir}/check_pdns.py
%{pnp4nagios_templatedir}/check_pdns.php

%changelog