[svn] r6526 - trunk/rpms/nagios

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Tue Oct 21 16:19:43 CEST 2008


Author: cmr
Date: 2008-10-21 15:19:43 +0100 (Tue, 21 Oct 2008)
New Revision: 6526

Modified:
   trunk/rpms/nagios/nagios.spec
Log:
update to nagios 3


Modified: trunk/rpms/nagios/nagios.spec
===================================================================
--- trunk/rpms/nagios/nagios.spec	2008-10-20 13:51:11 UTC (rev 6525)
+++ trunk/rpms/nagios/nagios.spec	2008-10-21 14:19:43 UTC (rev 6526)
@@ -12,10 +12,11 @@
 
 ### FIXME: TODO: Add sysv script based on template. (remove cmd-file on start-up)
 %define logmsg logger -t %{name}/rpm
+%define logdir %{_localstatedir}/log/nagios/
 
 Summary: Open Source host, service and network monitoring program
 Name: nagios
-Version: 2.12
+Version: 3.0.4
 Release: 1
 License: GPL
 Group: Applications/System
@@ -53,31 +54,33 @@
 %prep
 %setup
 
-%{__perl} -pi.orig -e 's|/usr/local/nagios/var/rw|%{_localstatedir}/nagios/rw|g;' eventhandlers/submit_check_result
+# /usr/local/nagios is hardcoded in many places
+%{__perl} -pi.orig -e 's|/usr/local/nagios/var/rw|%{_localstatedir}/nagios/rw|g;' contrib/eventhandlers/submit_check_result
 
 %build
 %configure \
-    --datadir="%{_datadir}/nagios" \
-    --libexecdir="%{_libdir}/nagios/plugins" \
-    --localstatedir="%{_localstatedir}/log/nagios" \
-    --sbindir="%{_libdir}/nagios/cgi" \
-    --sysconfdir="%{_sysconfdir}/nagios" \
-    --with-cgiurl="/nagios/cgi-bin" \
-    --with-command-user="apache" \
-    --with-command-group="apache" \
-    --with-gd-lib="%{_libdir}" \
-    --with-gd-inc="%{_includedir}" \
-    --with-htmurl="/nagios" \
-    --with-init-dir="%{_initrddir}" \
-    --with-lockfile="%{_localstatedir}/run/nagios.pid" \
-    --with-mail="/bin/mail" \
-    --with-nagios-user="nagios" \
-    --with-nagios-group="nagios" \
+	--datadir="%{_datadir}/nagios" \
+	--libexecdir="%{_libdir}/nagios/plugins" \
+	--localstatedir="%{_localstatedir}/nagios" \
+	--with-checkresult-dir="%{_localstatedir}/nagios/spool/checkresults" \
+	--sbindir="%{_libdir}/nagios/cgi" \
+	--sysconfdir="%{_sysconfdir}/nagios" \
+	--with-cgiurl="/nagios/cgi-bin" \
+	--with-command-user="apache" \
+	--with-command-group="apache" \
+	--with-gd-lib="%{_libdir}" \
+	--with-gd-inc="%{_includedir}" \
+	--with-htmurl="/nagios" \
+	--with-init-dir="%{_initrddir}" \
+	--with-lockfile="%{_localstatedir}/run/nagios.pid" \
+	--with-mail="/bin/mail" \
+	--with-nagios-user="nagios" \
+	--with-nagios-group="nagios" \
 %{!?_without_embedperl:--enable-embedded-perl} \
 %{!?_without_perlcache:--with-perlcache} \
-    --with-template-objects \
-    --with-template-extinfo \
-    --enable-event-broker
+	--with-template-objects \
+	--with-template-extinfo \
+	--enable-event-broker
 %{__make} %{?_smp_mflags} all
 
 ### Apparently contrib wants to do embedded-perl stuff as well and does not obey configure !
@@ -88,16 +91,16 @@
 %install
 %{__rm} -rf %{buildroot}
 %{__make} install install-init install-commandmode install-config \
-    DESTDIR="%{buildroot}" \
-    INSTALL_OPTS="" \
-    COMMAND_OPTS="" \
-    INIT_OPTS=""
+        DESTDIR="%{buildroot}" \
+        INSTALL_OPTS="" \
+        COMMAND_OPTS="" \
+        INIT_OPTS=""
 
 ### Apparently contrib wants to do embedded-perl stuff as well and does not obey configure !
 %if %{!?_without_embedperl:1}0
 %{__make} install -C contrib \
-    DESTDIR="%{buildroot}" \
-    INSTALL_OPTS=""
+	DESTDIR="%{buildroot}" \
+	INSTALL_OPTS=""
 %endif
 
 %{__install} -d -m0755 %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
@@ -108,47 +111,57 @@
 
 %{__install} -Dp -m0644 sample-config/httpd.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/nagios.conf
 
+# FIX log-paths 
+%{__sed} -i -e s at log_file.*@log_file=%{logdir}nagios.log@ \
+	-e s at log_archive_path=.*@log_archive_path=%{logdir}archives@ \
+	-e s at debug_file=.*@debug_file=%{logdir}nagios.debug@ \
+	%{buildroot}%{_sysconfdir}/nagios/nagios.cfg
+
+# make logdirs
+%{__mkdir} -p %{buildroot}%{logdir}
+%{__mkdir} -p %{buildroot}%{logdir}archives
+
 ### Install logos
 tar -xvz -C %{buildroot}%{_datadir}/nagios/images/logos -f %{SOURCE1}
 
 %pre
 if ! /usr/bin/id nagios &>/dev/null; then
-    /usr/sbin/useradd -r -d %{_localstatedir}/log/nagios -s /bin/sh -c "nagios" nagios || \
-        %logmsg "Unexpected error adding user \"nagios\". Aborting installation."
+	/usr/sbin/useradd -r -d %{logdir} -s /bin/sh -c "nagios" nagios || \
+		%logmsg "Unexpected error adding user \"nagios\". Aborting installation."
 fi
 if ! /usr/bin/getent group nagiocmd &>/dev/null; then
-    /usr/sbin/groupadd nagiocmd &>/dev/null || \
-        %logmsg "Unexpected error adding group \"nagiocmd\". Aborting installation."
+	/usr/sbin/groupadd nagiocmd &>/dev/null || \
+		%logmsg "Unexpected error adding group \"nagiocmd\". Aborting installation."
 fi
 
 %post
 /sbin/chkconfig --add nagios
 
 if /usr/bin/id apache &>/dev/null; then
-    if ! /usr/bin/id -Gn apache 2>/dev/null | grep -q nagios ; then
-        /usr/sbin/usermod -G nagios,nagiocmd apache &>/dev/null
-    fi
+	if ! /usr/bin/id -Gn apache 2>/dev/null | grep -q nagios ; then
+		/usr/sbin/usermod -G nagios,nagiocmd apache &>/dev/null
+	fi
 else
-    %logmsg "User \"apache\" does not exist and is not added to group \"nagios\". Sending commands to Nagios from the command CGI is not possible."
+	%logmsg "User \"apache\" does not exist and is not added to group \"nagios\". Sending commands to Nagios from the command CGI is not possible."
 fi
 
 if [ -f %{_sysconfdir}/httpd/conf/httpd.conf ]; then
-    if ! grep -q "Include .*/nagios.conf" %{_sysconfdir}/httpd/conf/httpd.conf; then
-        echo -e "\n# Include %{_sysconfdir}/httpd/conf.d/nagios.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf
-#       /sbin/service httpd restart
-    fi
+	if ! grep -q "Include .*/nagios.conf" %{_sysconfdir}/httpd/conf/httpd.conf; then
+		echo -e "\n# Include %{_sysconfdir}/httpd/conf.d/nagios.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf
+#		/sbin/service httpd restart
+	fi
 fi
 
 %preun
 if [ $1 -eq 0 ]; then
-    /sbin/service nagios stop &>/dev/null || :
-    /sbin/chkconfig --del nagios
+	/sbin/service nagios stop &>/dev/null || :
+	/sbin/chkconfig --del nagios
 fi
 
 %postun
 if [ $1 -eq 0 ]; then
-    /usr/sbin/userdel nagios || %logmsg "User \"nagios\" could not be deleted."
-    /usr/sbin/groupdel nagios || %logmsg "Group \"nagios\" could not be deleted."
+	/usr/sbin/userdel nagios || %logmsg "User \"nagios\" could not be deleted."
+	/usr/sbin/groupdel nagios || %logmsg "Group \"nagios\" could not be deleted."
 fi
 /sbin/service nagios condrestart &>/dev/null || :
 
@@ -175,18 +188,27 @@
 %defattr(-, nagios, nagios, 0755)
 %dir %{_sysconfdir}/nagios/
 %config(noreplace) %{_sysconfdir}/nagios/*.cfg
-%{_localstatedir}/log/nagios/
+%config(noreplace) %{_sysconfdir}/nagios/objects
+%{_localstatedir}/nagios
+%{_localstatedir}/nagios/spool
+%{logdir}
 
 %defattr(-, nagios, apache, 2755)
-%{_localstatedir}/log/nagios/rw/
-### FIXME: Start using /var/spool/nagios instead of /var/log/nagios/rw ??
-#%{_localstatedir}/spool/nagios/
+%{_localstatedir}/nagios/rw/
 
 %files devel
 %defattr(-, root, root, 0755)
 %{_includedir}/nagios/
 
 %changelog
+* Tue Oct 21 2008 Christoph Maser <cmr$financial,com> - 3.0.4-1
+- Updated to release 3.0.4
+
+* Wed Oct 10 2008 Christoph Maser <cmr$financial,com> - 3.0.3-1
+- Updated to release 3.0.3
+- Set localstatedir to ${_localstatedir} 
+- Because of the previous modify installed configs to put logs in %{logdir}
+
 * Thu May 22 2008 Dag Wieers <dag at wieers.com> - 2.12-1
 - Updated to release 2.12.
 




More information about the commits mailing list