File nagios-nrpe.spec of Package nagios-nrpe

#
# spec file for package nagios-nrpe (Version 2.12)
#
# Copyright (c) 2008 Christian Wittmer, Deidesheim, Germany
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via <chris@computersalat.de>
#

# norootforbuild

%if %{?rel:0}%{!?rel:1}
%define rel 2
%endif
%define nsusr nagios
%define nsgrp nagios
%define _libexecdir %{_prefix}/lib/nagios/plugins

#Distribution:   %dist
#Packager:       %packager
#Vendor:         %vendor

Name:           nagios-nrpe
Summary:        Nagios Remote Plug-In Executor
Version:        2.12
Release:        %{rel}.%{pid}
License:        GNU General Public License (GPL)
Group:          System/Monitoring
URL:            http://www.nagios.org/
Autoreqprov:    on
Source0:        nrpe-%{version}.tar.bz2
Source1:        nrpe.init
Patch0:         nrpe-2.10-Makefile.patch
Patch1:         xinetd.patch
Patch2:         nrpe-2.12-includedir.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

PreReq:         pwdutils grep
BuildRequires:  krb5-devel nagios-plugins tcpd-devel
BuildRequires:  mysql-devel

%if 0%{?suse_version} > 1020
BuildRequires:  libopenssl-devel openssl
%else
BuildRequires:  openssl-devel
%endif

Requires:       %{name}
Requires:       inet-daemon nagios-plugins openssl
Provides:       nrpe

#-------------------------------------------------------------------------------
%description
#-------------------------------------------------------------------------------
%{name} can be used to run nagios plug-ins on a remote machine for
executing local checks.
This package contains the software for NRPE server.

Authors:
--------
    Ethan Galstad <nagios@nagios.org>

--------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
%package plugin
#-------------------------------------------------------------------------------
Summary:        Nagios NRPE Plugin (check_nrpe)
Group:          System/Monitoring
Requires:       nagios-plugins openssl
Provides:       nrpe-plugin

#-------------------------------------------------------------------------------
%description plugin
#-------------------------------------------------------------------------------
This package contains the plugin (check_nrpe) you need on your nagios
Server to run local checks on your remote host.

Authors:
--------
    Ethan Galstad <nagios@nagios.org>

--------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
%package doc
#-------------------------------------------------------------------------------
Summary:        Nagios NRPE docs
Group:          System/Monitoring
Provides:       nrpe-doc

#-------------------------------------------------------------------------------
%description doc
#-------------------------------------------------------------------------------
This package contains the docs for nrpe

Authors:
--------
    Ethan Galstad <nagios@nagios.org>

--------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
%prep
#-------------------------------------------------------------------------------
%setup -n nrpe-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1

%{?suse_update_config:%{suse_update_config}}

#-------------------------------------------------------------------------------
%build
#-------------------------------------------------------------------------------
autoconf
export CFLAGS="$RPM_OPT_FLAGS"
%if %suse_version > 1000
export CFLAGS="$CFLAGS -fstack-protector"
%endif
./configure \
	--prefix=%{_prefix} \
	--bindir=%{_prefix}/sbin \
	--sbindir=%{_prefix}/lib/nagios/cgi \
	--libexecdir=%{_libexecdir} \
	--datadir=%{_prefix}/share/nagios \
	--sysconfdir=/etc/nagios \
	--includedir=%{_includedir} \
	--localstatedir=/var/log/nagios \
	--with-init-dir=/etc/init.d \
	--with-nrpe-user=%{nsusr} \
	--with-nrpe-group=%{nsgrp} \
	--with-nrpe-port=5666 \
	--enable-ssl \
	--enable-command-args

%{__make} %{?jobs:-j%jobs} all

#-------------------------------------------------------------------------------
%install
#-------------------------------------------------------------------------------
%{__make} DESTDIR=$RPM_BUILD_ROOT NAGIOS_INSTALL_OPTS="" NRPE_INSTALL_OPTS="" install

%{__mkdir} -p $RPM_BUILD_ROOT/etc/init.d
%{__install} -m 755 %{SOURCE1}     $RPM_BUILD_ROOT/etc/init.d/nrpe
%{__ln_s} -f ../../etc/init.d/nrpe $RPM_BUILD_ROOT/usr/sbin/rcnrpe


#----------------------------------------------------------------------
%pre
#----------------------------------------------------------------------
#echo "PARAM_pre: "$1
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
if [ "$1" = "1" ]; then
  #/usr/sbin/groupadd -r %{name} 2> /dev/null || :
  if [ -z  "`%__grep "%{nsgrp}:"/etc/group 2>/dev/null`" ]; then
    %{_sbindir}/groupadd -r %{nsgrp}
  fi
  #/usr/sbin/useradd  -r -o -g %{name} -s /bin/false -c "User for Nagios" -d /var/lib/%{name} %{name} 2> /dev/null || :
  if [ -z "`%__grep "^%{nsusr}" /etc/passwd 2>/dev/null`" ]; then
    %{_sbindir}/useradd -r -o -g %{nsusr} -s /bin/false -c "User for Nagios" -d /var/lib/%{name} %{nsusr}
  fi
fi

#-------------------------------------------------------------------------------
%preun
#-------------------------------------------------------------------------------
%stop_on_removal nrpe

#-------------------------------------------------------------------------------
%postun
#-------------------------------------------------------------------------------
%restart_on_update nrpe
%insserv_cleanup

#-------------------------------------------------------------------------------
%clean
#-------------------------------------------------------------------------------
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT

#-------------------------------------------------------------------------------
%files
#-------------------------------------------------------------------------------
%defattr(-,root,root)
%config(noreplace) /etc/nagios/nrpe.cfg
%config(noreplace) /etc/xinetd.d/nrpe
/etc/init.d/nrpe
%{_sbindir}/*nrpe

#-------------------------------------------------------------------------------
%files plugin
#-------------------------------------------------------------------------------
%defattr(-,root,root)
%{_libexecdir}/check_nrpe

#-------------------------------------------------------------------------------
%files doc
#-------------------------------------------------------------------------------
%defattr(-,root,root)
%doc Changelog LEGAL README README.SSL SECURITY docs/*

#-------------------------------------------------------------------------------
%changelog
#-------------------------------------------------------------------------------
* Thu Jan 15 2009 - chris@computersalat.de - 2.12
- upgrade to new version
- made subpackage doc
- some rpmlint/spec fixes
* Thu Dec 06 2007 - chris@computersalat.de - 2.10 - 2
- fixed doc (added README.SSL SECURITY)
- moved nrpe to /usr/sbin
- changed nobody:nogroup to nagios:nagios
* Thu Dec 06 2007 - chris@computersalat.de - 2.10 - 1
- initial package
openSUSE Build Service is sponsored by