File nagios-virt.spec of Package nagios-virt

#
# spec file for package nagios-virt
#
# Copyright (c) 2014 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:           nagios-virt
Summary:        Nagios support for virtualisation
Version:        0.2.0
Release:        1
Url:            http://people.redhat.com/~rjones/nagios-virt/
License:        GPL-2.0+
Group:          System/Monitoring
Source0:        %{name}-%{version}.tar.bz2
Patch1:         nagios-virt-missing_declarations.patch
Patch2:         nagios-virt-format_error.patch
Requires:       coreutils
BuildRequires:  gcc
BuildRequires:  nagios
BuildRequires:  nagios-devel
BuildRequires:  nagios-rpm-macros
BuildRequires:  libvirt-devel
BuildRequires:  libxml2-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Nagios-virt is a configuration tool for adding monitoring of your virtualised
domains to Nagios. You can use this tool to either set up a new Nagios
installation for your Xen or QEMU/KVM guests, or to integrate with your
existing Nagios installation.

Nagios-virt is built on top of libvirt so it works with several different
virtualisation systems. 

%prep
%setup -q
%patch1 -p1
%patch2 -p1

%build
export NAGIOS='%{_sbindir}/nagios' \
%configure \
  --with-nagios-configdir=%{nagios_confdir}
%{__make} %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{nagios_plugindir}
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}

%{__make} \
	DESTDIR="%{buildroot}" \
	libdir="%{_prefix}/lib" \
	NV_DATADIR="%{_defaultdocdir}/%{name}" \
	install

# documentation
install -m644 COPYING README %{buildroot}/%{_defaultdocdir}/%{name}/
# binary
mv %{buildroot}/%{_sbindir}/nagios-virt/nagios-virt %{buildroot}/%{_sbindir}/nagios-virt.new
rmdir %{buildroot}/%{_sbindir}/nagios-virt
mv %{buildroot}/%{_sbindir}/nagios-virt{.new,}

%clean
rm -rf %buildroot

%files 
%defattr(0644,root,root,0755)
%doc %{_defaultdocdir}/%{name}
%defattr(-,root,root)
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_virt
%{_sbindir}/nagios-virt

%changelog