File nrpe.spec of Package test
%define name nrpe
%define version 2.12
%define release 1b1
%define nsusr prftnrpe
%define nsgrp prftnrpe
%define nsport 8086
%define _installdir /opt/PRFTngsc
Summary: Host/service/network monitoring agent for Nagios
URL: http://www.nagios.org
Name: PRFTngsc
Version: %{version}
Release: %{release}
License: GPL
Group: Application/System
Source0: nrpe-%{version}.tar.gz
#BuildRoot: %{main_dir}/BUILDROOT
BuildRoot: %{buildroot}
Prefix: %{_prefix}
BuildRequires: openssl-devel
%description
Nagios NPRE en meuk
%prep
%setup -T -c -a 0
%pre
# Create `nagios' group on the system if necessary
if grep ^%{nsgrp}: /etc/group; then
: # group already exists
else
/usr/sbin/groupadd %{nsgrp} || \
%nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process.
fi
# Create `nagios' user on the system if necessary
if id %{nsusr} ; then
: # user already exists
else
/usr/sbin/useradd -r -d /opt/PRFTngsc -s /bin/sh -c "%{nsusr}" -g %{nsgrp} \
%{nsusr} || \
%nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process.
fi
# if LSB standard /etc/init.d does not exist,
# create it as a symlink to the first match we find
if [ -d /etc/init.d -o -L /etc/init.d ]; then
: # we're done
elif [ -d /etc/rc.d/init.d ]; then
ln -s /etc/rc.d/init.d /etc/init.d
elif [ -d /usr/local/etc/rc.d ]; then
ln -s /usr/local/etc/rc.d /etc/init.d
elif [ -d /sbin/init.d ]; then
ln -s /sbin/init.d /etc/init.d
fi
%preun
if [ "$1" = 0 ]; then
/sbin/service nrpe stop > /dev/null 2>&1
/sbin/chkconfig --del nrpe
fi
%postun
if [ "$1" -ge "1" ]; then
/sbin/service nrpe condrestart >/dev/null 2>&1 || :
fi
%build
cd nrpe-2.12
./configure --prefix=/opt/PRFTngsc \
--with-init-dir=/etc/init.d \
--with-nrpe-user=prftngsc \
--with-nrpe-group=prftngsc \
--with-nagios-user=prftngsc \
--with-nagios-group=prftngsc \
--with-nrpe-port=8086 #\
# --enable-ssl
make
%install
rm -rf %{_buildrootdir}
cd nrpe-2.12
make install DESTDIR=$RPM_BUILD_ROOT
#mkdir -p $RPM_BUILD_ROOT/opt/PRFT
%clean
rm -rf %{_buildrootdir}
%files
#%{_buildrootdir}/opt/PRFTngsc
%{_installdir}/*
%changelog