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

Name:           nagios-virt
Summary:        Nagios support for virtualisation
Version:        0.2.0
Release:        1
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

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. 

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

export NAGIOS='%{_sbindir}/nagios' \
%configure \
%{__make} %{?_smp_mflags}

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

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

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

rm -rf %buildroot

%doc %{_defaultdocdir}/%{name}
%dir %{nagios_libdir}
%dir %{nagios_plugindir}