| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- ##
- ## nagios.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
- ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package versions
- %define V_nagios 1.3
- %define V_nagios_plugins 1.4.2
- # package information
- Name: nagios
- Summary: System and Network Monitoring
- URL: http://www.nagios.org/
- Vendor: Ethan Galstad et al.
- Packager: OpenPKG
- Distribution: OpenPKG
- Class: EVAL
- Group: Network
- License: GNU
- Version: %{V_nagios}
- Release: 20060123
- # package options
- %option with_eperl yes
- %option with_fsl yes
- %option with_ldap yes
- # list of sources
- Source0: http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-%{V_nagios}.tar.gz
- Source1: http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-%{V_nagios_plugins}.tar.gz
- Source2: etc.tar
- Source3: rc.nagios
- Source4: fsl.nagios
- Patch0: nagios.patch
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- BuildPreReq: OpenPKG, openpkg >= 20040130, traceroute, gcc
- PreReq: OpenPKG, openpkg >= 20040130, traceroute, apache, MTA
- BuildPreReq: zlib, jpeg, png, gd
- PreReq: zlib, jpeg, png, gd
- BuildPreReq: openssl, openssh, coreutils, inetutils, fping
- PreReq: openssl, openssh, coreutils, inetutils, fping
- %if "%{with_ldap}" == "yes"
- BuildPreReq: openldap
- PreReq: openldap
- %endif
- %if "%{with_fsl}" == "yes"
- BuildPreReq: fsl >= 1.3.0
- PreReq: fsl >= 1.3.0
- %endif
- AutoReq: no
- AutoReqProv: no
- %description
- Nagios is a system and network monitoring application. It watches
- hosts and services that you specify, alerting you when things go bad
- and when they get better.
- %track
- prog nagios = {
- version = %{V_nagios}
- url = http://prdownloads.sourceforge.net/nagios/
- regex = nagios-(\d+(\.\d+)+)\.tar\.gz
- }
- prog nagios:plugins = {
- version = %{V_nagios_plugins}
- url = http://prdownloads.sourceforge.net/nagiosplug/
- regex = nagios-plugins-(\d+(\.\d+)+)\.tar\.gz
- }
- %prep
- %setup -q
- %setup -q -T -D -a 1
- %setup -q -T -D -a 2
- %patch -p0
- %{l_shtool} subst \
- -e 's;LDAPLIBS=.*-lldap.*;LDAPLIBS="-lldap -llber -lssl -lcrypto";' \
- -e 's;LDAPINCLUDE=.*-I.*;LDAPINCLUDE="-I/%{l_prefix}/include";' \
- nagios-plugins-%{V_nagios_plugins}/configure
- %build
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
- LIBS="%{l_fsl_libs} -lpng -ljpeg" \
- PATH_TO_TRACEROUTE="%{l_prefix}/sbin/traceroute" \
- ./configure \
- --prefix=%{l_prefix} \
- --sbindir=%{l_prefix}/cgi/nagios \
- --sysconfdir=%{l_prefix}/etc/nagios \
- --libexecdir=%{l_prefix}/libexec/nagios \
- --localstatedir=%{l_prefix}/var/nagios \
- --datadir=%{l_prefix}/web/nagios \
- --with-cgiurl=/nagios/cgi \
- --with-htmurl=/nagios \
- --with-nagios-user=%{l_musr} \
- --with-nagios-grp=%{l_mgrp} \
- --with-gd-lib=%{l_prefix}/lib \
- --with-gd-inc=%{l_prefix}/include \
- --with-lockfile=%{l_prefix}/var/nagios/nagios.pid \
- %if "%{with_eperl}" == "yes"
- --enable-embedded-perl \
- %endif
- --without-init-dir
- %{l_make} %{l_mflags} all GDLIBS="-lgd -lm -lpng -lz -ljpeg"
- # configure and build plugins
- ( cd nagios-plugins-%{V_nagios_plugins}/
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
- PATH_TO_PING="%{l_prefix}/bin/gping" \
- PING_PACKETS_FIRST="yes" \
- PATH_TO_SSH="%{l_prefix}/bin/ssh" \
- LIBS="-lssl -lcrypto"
- ./configure \
- --prefix=%{l_prefix}/libexec/nagios \
- --libexecdir=%{l_prefix}/libexec/nagios \
- --with-openssl=%{l_prefix} \
- --with-df-command=%{l_prefix}/bin/gdf \
- --with-ping-command="%{l_prefix}/bin/gping -n -c %d %s" \
- --with-nagios-user=%{l_musr} \
- --with-nagios-group=%{l_mgrp} \
- --with-cgiurl=/nagios/cgi
- %{l_make} %{l_mflags}
- ) || exit $?
- %install
- rm -rf $RPM_BUILD_ROOT
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/nagios \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios \
- $RPM_BUILD_ROOT%{l_prefix}/var/nagios/log \
- $RPM_BUILD_ROOT%{l_prefix}/var/nagios/rw
- %{l_make} install DESTDIR="$RPM_BUILD_ROOT" INSTALL_OPTS="" COMMAND_OPTS=""
- # install plugins
- ( cd nagios-plugins-%{V_nagios_plugins}/
- %{l_make} install DESTDIR="$RPM_BUILD_ROOT"
- ) || exit $?
- # install default configuration
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- etc/* $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
- # install start script
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.nagios} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # install OSSP fsl configuration
- %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- %{SOURCE fsl.nagios} \
- $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%not %dir %{l_prefix}/etc/fsl' \
- '%config %{l_prefix}/etc/fsl/fsl.nagios' \
- '%config %{l_prefix}/etc/nagios/*'
- %files -f files
- %clean
- rm -rf $RPM_BUILD_ROOT
- %post
- # after upgrade, restart service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} nagios status 2>/dev/null`
- [ ".$nagios_active" = .yes ] && %{l_rc} nagios restart
- exit 0
- %preun
- # before erase, stop service and remove log files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} nagios stop 2>/dev/null
- rm -f $RPM_INSTALL_PREFIX/var/nagios/log/*.log* >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/nagios/status.sav >/dev/null 2>&1 || true
- exit 0
|