File nagios-nsca.spec of Package nagios-nsca

#
# spec file for package nagios-nsca
#
# Copyright (c) 2012 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-nsca
BuildRequires:  libmcrypt-devel
BuildRequires:  tcpd-devel
Summary:        The Nagios Service Check Acceptor
License:        GPL-2.0+
Group:          System/Monitoring
Version:        2.9.1
Release:        0
Url:            http://www.nagios.org/
BuildRequires:  nagios-rpm-macros
Requires:       nagios >= 2.5
Provides:       netsaint-nsca = %{version}
Obsoletes:      netsaint-nsca < %{version}
Source0:        http://prdownloads.sourceforge.net/nagios/nsca-%{version}.tar.bz2
Source1:        rcnsca
Source2:        nagios-nsca-rpmlintrc
Patch1:         nagios-nsca.abuild.patch
Patch2:         nagios-nsca.xinetd.patch
Patch3:         nagios-nsca.spooldir.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The purpose of this add-on is to allow the execution of NetSaint and
Nagios plug-ins on a remote host in a manner that is as transparent as
possible. This is the server part including the daemon without the
client program.


%package client
Summary:        The Nagios Service Check Acceptor Client
Group:          System/Monitoring

%description client
The purpose of this add-on is to allow the execution of NetSaint and
Nagios plug-ins on a remote host in a manner that is as transparent as
possible. This package includes only the client program.


%prep
%setup -n nsca-%{version} 
%patch1 
%patch2
%patch3

%build
export CFLAGS="$RPM_OPT_FLAGS"
%if %suse_version > 1000
export CFLAGS="$CFLAGS -fstack-protector"
%endif
./configure \
	--prefix=%{_prefix} \
	--sysconfdir=%{nagios_sysconfdir} \
	--localstatedir=%{nagios_spooldir} \
	--with-nsca-user=%{nagios_user} \
	--with-nsca-grp=%{nagios_group} \
	--with-nsca-port=5667
make all

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/%{nagios_sysconfdir}
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
mkdir -p $RPM_BUILD_ROOT/etc/xinetd.d/
install -m 755 src/nsca $RPM_BUILD_ROOT/usr/bin/
install -m 755 src/send_nsca $RPM_BUILD_ROOT/usr/bin/
install -m 644 sample-config/nsca.cfg $RPM_BUILD_ROOT/%{nagios_sysconfdir}/
install -m 644 sample-config/send_nsca.cfg $RPM_BUILD_ROOT/%{nagios_sysconfdir}/
install -m 644 sample-config/nsca.xinetd $RPM_BUILD_ROOT/etc/xinetd.d/nsca
install -m 755 %{SOURCE1}    $RPM_BUILD_ROOT/etc/init.d/nsca
ln -sf ../../etc/init.d/nsca $RPM_BUILD_ROOT/%{_sbindir}/rcnsca

chmod 644 README

%preun
%stop_on_removal nsca

%postun
%restart_on_update nsca
%insserv_cleanup

%clean
rm -rf $RPM_BUILD_ROOT;

%files
%defattr(-,root,root)
%{_bindir}/nsca
/etc/init.d/nsca
%{_sbindir}/rcnsca
%config(noreplace) %{nagios_sysconfdir}/nsca.cfg
%config(noreplace) /etc/xinetd.d/nsca
%doc Changelog README SECURITY LEGAL

%files client
%defattr(-,root,root)
%{_bindir}/send_nsca
%dir %{nagios_sysconfdir}
%config(noreplace) %{nagios_sysconfdir}/send_nsca.cfg

%changelog
openSUSE Build Service is sponsored by