Browse Source

blind commit of some fixes which has not been tested yet; added plugins as well

Christoph Schug 21 years ago
parent
commit
8fc5bb6caf
1 changed files with 73 additions and 102 deletions
  1. 73 102
      nagios/nagios.spec

+ 73 - 102
nagios/nagios.spec

@@ -23,35 +23,43 @@
 ##  SUCH DAMAGE.
 ##
 
+#   package versions
+%define       V_nagios          1.2
+%define       V_nagios_plugins  1.3.1
+
 #   package information
 Name:         nagios
 Summary:      System and Network Monitoring
 URL:          http://www.nagios.org/
-Vendor:       Ethan Galstad
+Vendor:       Ethan Galstad et al.
 Packager:     The OpenPKG Project
 Distribution: OpenPKG
 Class:        EVAL
 Group:        Network
 License:      GNU
-Version:      1.2
-Release:      20040203
+Version:      %{V_nagios}
+Release:      20040309
 
 #   package options
-%option       with_fsl  yes
+%option       with_eperl  yes
+%option       with_fsl    yes
 
 #   list of sources
-Source0:      http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz
-Source1:      rc.nagios
-Source2:      fsl.nagios
+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:      rc.nagios
+Source3:      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
-BuildPreReq:  gd, jpeg, png, zlib
-PreReq:       gd, jpeg, png, zlib
+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_fsl}" == "yes"
 BuildPreReq:  fsl >= 1.3.0
 PreReq:       fsl >= 1.3.0
@@ -66,121 +74,83 @@ AutoReqProv:  no
 
 %track
     prog nagios = {
-        version   = %{version}
+        version   = %{V_nagios}
         url       = http://osdn.dl.sourceforge.net/sourceforge/nagios/
-        regex     = nagios-(\d+\.\d+(\.\d+)?)\.tar\.gz
+        regex     = nagios-(\d+(\.\d+)+)\.tar\.gz
+    }
+    prog nagios::plugins = {
+        version   = %{V_nagios_plugins}
+        url       = http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/
+        regex     = nagios-plugins-(\d+(\.\d+)+)\.tar\.gz
     }
 
 %prep
     %setup -q
+    %setup -q -T -D -a 1
     %patch -p0
 
 %build
-    %{l_shtool} subst \
-        -e 's;localstatedir=.\${prefix}/var.;localstatedir="'%{l_prefix}'/var/nagios";g' \
-        -e 's;datadir=.\${prefix}/share.;datadir="'%{l_prefix}'/share/nagios";g' \
-        -e 's;sysconfdir=.\${prefix}/etc.;sysconfdir="'%{l_prefix}'/etc/nagios";g' \
-        -e 's;libexecdir=.\${prefix}/libexec.;libexecdir="'%{l_prefix}'/libexec/nagios";g' \
-        configure
-    %{l_shtool} subst \
-        -e 's;log_file=.*;log_file=/dev/null;' \
-        sample-config/nagios.cfg.in
-    echo "ac_cv_path_PATH_TO_TRACEROUTE=%{l_prefix}/sbin/traceroute}" >config.cache
     CC="%{l_cc}" \
     CFLAGS="%{l_cflags -O}" \
     LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
-    LIBS="-ljpeg" \
-    PERLLIBS="%{l_fsl_libs}" \
+    LIBS="%{l_fsl_libs}" \
+    PATH_TO_TRACEROUTE="%{l_prefix}/sbin/traceroute" \
     ./configure \
         --prefix=%{l_prefix} \
-        --with-cgiurl=%{l_prefix}/cgi/nagios \
-        --with-htmurl=%{l_prefix}/share/nagios \
+        --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.lock
-
-    %{l_make} all %{l_mflags} \
-        GDLIBS="-lgd -lm -lpng -lz -ljpeg" \
-        LOGDIR=%{l_prefix}/var/nagios \
-        CFGDIR=%{l_prefix}/etc/nagios \
-        BINDIR=%{l_prefix}/bin \
-        CGIDIR=%{l_prefix}/cgi/nagios \
-        HTMLDIR=%{l_prefix}/share/nagios
+        --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" \
+      PATH_TO_SSH="%{l_prefix}/bin/ssh" \
+      ./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-grp=%{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}/sbin \
-        $RPM_BUILD_ROOT%{l_prefix}/var/nagios/rw \
         $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios \
-        $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/ssi
-
-    #   install nagios
-    %{l_shtool} install -c -s -m 755 \
-        base/nagios $RPM_BUILD_ROOT%{l_prefix}/sbin/
-
-    #   install html
-    %{l_shtool} install -c -m 644 \
-        html/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/
-    %{l_shtool} install -c -m 644 \
-        html/docs/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
-    %{l_shtool} install -c -m 644 \
-        html/media/*.wav $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media/
-    %{l_shtool} install -c -m 644 \
-        html/stylesheets/*.css $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets/
-    %{l_shtool} install -c -m 644 \
-        html/contexthelp/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp/
-    %{l_shtool} install -c -m 644 \
-        html/docs/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
-    %{l_shtool} install -c -m 644 \
-        html/docs/images/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images/
-    %{l_shtool} install -c -m 644 \
-        html/images/*.gif html/images/*.jpg html/images/*.png \
-        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/
-    %{l_shtool} install -c -m 644 \
-        html/images/logos/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos/
-
-    #   install cgis
-    %{l_shtool} install -c -s -m 755 \
-         cgi/*.cgi $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios/
-
-    #   install sample config
-    %{l_shtool} install -c -m 644 \
-        sample-config/nagios.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/cgi.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/resource.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/checkcommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/contactgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/contacts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        /dev/null $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/dependencies.cfg
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/escalations.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/hostgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/hosts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/misccommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/services.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
-    %{l_shtool} install -c -m 644 \
-        sample-config/template-object/timeperiods.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/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 start script
     %{l_shtool} install -c -m 755 %{l_value -s -a} \
@@ -196,7 +166,8 @@ AutoReqProv:  no
     %{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/fsl/fsl.nagios' \
+        '%config %{l_prefix}/etc/nagios/*'
 
 %files -f files