[csw-devel] SF.net SVN: gar:[14710] csw/mgar/pkg/nagios/trunk
j_arndt at users.sourceforge.net
j_arndt at users.sourceforge.net
Sun Jun 5 11:03:30 CEST 2011
Revision: 14710
http://gar.svn.sourceforge.net/gar/?rev=14710&view=rev
Author: j_arndt
Date: 2011-06-05 09:03:29 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
nagios: update to 3.2.3, rewrite and cleanup of gar recipe
Modified Paths:
--------------
csw/mgar/pkg/nagios/trunk/Makefile
csw/mgar/pkg/nagios/trunk/files/CSWnagios.postinstall
csw/mgar/pkg/nagios/trunk/files/CSWnagios.preinstall
Added Paths:
-----------
csw/mgar/pkg/nagios/trunk/files/0002-changed-options-for-ginstall.patch
csw/mgar/pkg/nagios/trunk/files/README.CSW
csw/mgar/pkg/nagios/trunk/files/cswusergroup
Modified: csw/mgar/pkg/nagios/trunk/Makefile
===================================================================
--- csw/mgar/pkg/nagios/trunk/Makefile 2011-06-04 23:47:35 UTC (rev 14709)
+++ csw/mgar/pkg/nagios/trunk/Makefile 2011-06-05 09:03:29 UTC (rev 14710)
@@ -9,14 +9,16 @@
MASTER_SITES = $(SF_MIRRORS)
DISTFILES = $(NAME)-$(VERSION).tar.gz
-DISTFILES += CSWnagios.checkinstall CSWnagios.preinstall CSWnagios.preremove CSWnagios.prototype CSWnagios.postinstall
+DISTFILES += CSWnagios.preinstall
+DISTFILES += CSWnagios.postinstall
DISTFILES += cswnagios
+DISTFILES += cswusergroup
+DISTFILES += README.CSW
PATCHFILES = patch.diff # cgi/cmd.c - GNU macro __attribute__ unknown to compiler
# http://article.gmane.org/gmane.network.nagios.devel/4726
# (Error 2)
-PATCHFILES += install-opts.diff # sets in every Makefile.in "INSTALL_OPT="" (empty)
- # necessary, so ginstall doesn't get -o and -g options
+PATCHFILES += 0002-changed-options-for-ginstall.patch
PACKAGES = CSWnagios
CATALOGNAME = nagios
@@ -26,13 +28,35 @@
RUNTIME_DEP_PKGS_CSWnagios = CSWapache2 CSWgd CSWglib2 CSWiconv CSWjpeg CSWlibtoolrt CSWggettextrt
RUNTIME_DEP_PKGS_CSWnagios += CSWosslrt CSWperl CSWpng CSWzlib CSWnagiosp CSWap2modphp5 CSWbdb
+RUNTIME_DEP_PKGS_CSWnagios += CSWcswclassutils
-SPKG_CLASSES = none cswpreserveconf cswinitsmf
-
LICENSE = LICENSE
NOISALIST = 1
+#
+# prototype
+#
+
+PROTOTYPE_FILTER = awk '$$$$3 ~ /\/etc\/opt\/csw\/nagios/ { $$$$2 = "cswcptemplates" ; $$$$5 = "nagios" ; $$$$6 = "nagios" } \
+ $$$$3 ~ /\/var\/opt\/csw\/nagios/ { $$$$2 = "cswcptemplates" ; $$$$5 = "nagios" ; $$$$6 = "nagios" } \
+ $$$$3 ~ /\/var\/opt\/csw\/nagios\/rw/ { $$$$2 = "cswcptemplates" ; $$$$4 = "2755" ; $$$$5 = "nagios" ; $$$$6 = "nagioscm" } \
+ { print }'
+
+#
+# CSW class action utilities
+#
+
+SPKG_CLASSES = none cswusergroup ugfiles cswmigrateconf cswcptemplates cswinitsmf cswpostmsg
+
+INITSMF = /etc/opt/csw/init.d/cswnagios
+USERGROUP = /etc/opt/csw/pkg/CSWnagios/cswusergroup
+POSTMSG = /opt/csw/share/doc/nagios/README.CSW
+
+#
+# configure
+#
+
prefix = $(BUILD_PREFIX)/nagios
libexecdir = $(BUILD_PREFIX)/libexec/nagios-plugins
sysconfdir = /etc$(prefix)
@@ -41,56 +65,104 @@
CONFIGURE_ARGS += --prefix=$(prefix)
CONFIGURE_ARGS += --exec-prefix=$(exec_prefix)
CONFIGURE_ARGS += --with-command-user=nagios
-CONFIGURE_ARGS += --with-command-group=nagios
+CONFIGURE_ARGS += --with-command-group=nagioscm
CONFIGURE_ARGS += --with-httpd-conf=$(sysconfdir)
-CONFIGURE_ARGS += --with-gd-lib-dir=$(BUILD_PREFIX)/lib
-CONFIGURE_ARGS += --with-gd-lib-inc=$(BUILD_PREFIX)/inc
+CONFIGURE_ARGS += --with-gd-lib=$(BUILD_PREFIX)/lib
+CONFIGURE_ARGS += --with-gd-inc=$(BUILD_PREFIX)/inc
CONFIGURE_ARGS += --enable-embedded-perl
CONFIGURE_ARGS += --with-checkresult-dir=/var/opt/csw/nagios/spool/checkresults
CONFIGURE_ARGS += --with-lockfile=/var/opt/csw/nagios/nagios.lock
CONFIGURE_ARGS += --localstatedir=/var$(prefix)
+CONFIGURE_ENV += install_user=$(USER) install_group=csw # see PATCHFILES
+#
+# build
+#
+
EXTRA_LIB = $(BUILD_PREFIX)/lib
+LD_OPTIONS += -R/opt/csw/lib
+LD_OPTIONS += -R/opt/csw/nagios/lib
+
BUILD_ARGS = all
ENABLE_CHECK = 0
TEST_TARGET = none
-INSTALL_ARGS += install-init
+#
+# install
+#
+
+#INSTALL_ARGS += install-init
#INSTALL_ARGS += install-config
INSTALL_ARGS += install-commandmode
-LD_OPTIONS += -R/opt/csw/lib
-LD_OPTIONS += -R/opt/csw/nagios/lib
-
include gar/category.mk
-DOCS = Changelog INSTALLING README UPGRADING
-DOCDEST = $(DESTDIR)$(BUILD_PREFIX)/share/doc/nagios
-HTTPD_CONF = $(DESTDIR)$(sysconfdir)
-CFGDIR = /etc/$(prefix)
+DOCS = Changelog INSTALLING README UPGRADING
+DOCDEST = $(DESTDIR)$(BUILD_PREFIX)/share/doc/nagios
+HTTPD_CONF = $(DESTDIR)$(sysconfdir)
+CFGDIR = /etc/opt/csw/nagios
+TEMPLATEDIR = /opt/csw/etc/templates/CSWnagios/etc/opt/csw/nagios
post-install-modulated:
+ @#
+ @# copying docs
+ @#
@ginstall -m 755 -d $(DOCDEST)
@ginstall -m 755 -d $(HTTPD_CONF)
@$(foreach DOC,$(DOCS),ginstall -m 644 $(WORKSRC)/$(DOC) $(DOCDEST);)
@ginstall -m 644 $(WORKSRC)/LICENSE $(DOCDEST)
- @ginstall -d $(DESTDIR)/etc/opt/csw/init.d
- @ginstall -m 755 $(FILEDIR)/cswnagios $(DESTDIR)/etc/opt/csw/init.d/cswnagios
+ @ginstall -m 644 $(FILEDIR)/README.CSW $(DOCDEST)
+ @#
+ @# Start / Stopp script
+ @#
+ @ginstall -d $(DESTDIR)/etc/$(BUILD_PREFIX)/init.d
+ @ginstall -m 755 $(FILEDIR)/cswnagios $(DESTDIR)/etc/$(BUILD_PREFIX)/init.d/cswnagios
+ @#
+ @# creating config dirs
+ @#
@ginstall -m 775 -d $(DESTDIR)$(CFGDIR)
@ginstall -m 775 -d $(DESTDIR)$(CFGDIR)/objects
- @ginstall -b -m 664 $(WORKSRC)/sample-config/nagios.cfg $(DESTDIR)$(CFGDIR)/nagios.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/cgi.cfg $(DESTDIR)$(CFGDIR)/cgi.cfg.CSW
- @ginstall -b -m 660 $(WORKSRC)/sample-config/resource.cfg $(DESTDIR)$(CFGDIR)/resource.cfg.CSW
- @ginstall -b -m 644 $(WORKSRC)/sample-config/httpd.conf $(DESTDIR)$(CFGDIR)/httpd-nagios.conf
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/templates.cfg $(DESTDIR)$(CFGDIR)/objects/templates.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/commands.cfg $(DESTDIR)$(CFGDIR)/objects/commands.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/contacts.cfg $(DESTDIR)$(CFGDIR)/objects/contacts.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/timeperiods.cfg $(DESTDIR)$(CFGDIR)/objects/timeperiods.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/localhost.cfg $(DESTDIR)$(CFGDIR)/objects/localhost.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/windows.cfg $(DESTDIR)$(CFGDIR)/objects/windows.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/printer.cfg $(DESTDIR)$(CFGDIR)/objects/printer.cfg.CSW
- @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/switch.cfg $(DESTDIR)$(CFGDIR)/objects/switch.cfg.CSW
+ @#
+ @# preparing default config files -> cswcptemplate
+ @#
+ @ginstall -m 775 -d $(DESTDIR)$(TEMPLATEDIR)
+ @ginstall -m 775 -d $(DESTDIR)$(TEMPLATEDIR)/objects
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/nagios.cfg $(DESTDIR)$(TEMPLATEDIR)/nagios.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/cgi.cfg $(DESTDIR)$(TEMPLATEDIR)/cgi.cfg
+ @ginstall -b -m 660 $(WORKSRC)/sample-config/resource.cfg $(DESTDIR)$(TEMPLATEDIR)/resource.cfg
+ @ginstall -b -m 644 $(WORKSRC)/sample-config/httpd.conf $(DESTDIR)$(TEMPLATEDIR)/httpd-nagios.conf
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/templates.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/templates.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/commands.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/commands.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/contacts.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/contacts.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/timeperiods.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/timeperiods.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/localhost.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/localhost.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/windows.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/windows.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/printer.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/printer.cfg
+ @ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/switch.cfg $(DESTDIR)$(TEMPLATEDIR)/objects/switch.cfg
+ @#
+ @#ginstall -m 775 -d $(DESTDIR)$(TEMPLATEDIR)
+ @#ginstall -m 775 -d $(DESTDIR)$(TEMPLATEDIR)/objects
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/nagios.cfg $(DESTDIR)$(CFGDIR)/nagios.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/cgi.cfg $(DESTDIR)$(CFGDIR)/cgi.cfg.CSW
+ @#ginstall -b -m 660 $(WORKSRC)/sample-config/resource.cfg $(DESTDIR)$(CFGDIR)/resource.cfg.CSW
+ @#ginstall -b -m 644 $(WORKSRC)/sample-config/httpd.conf $(DESTDIR)$(CFGDIR)/httpd-nagios.conf.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/templates.cfg $(DESTDIR)$(CFGDIR)/objects/templates.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/commands.cfg $(DESTDIR)$(CFGDIR)/objects/commands.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/contacts.cfg $(DESTDIR)$(CFGDIR)/objects/contacts.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/timeperiods.cfg $(DESTDIR)$(CFGDIR)/objects/timeperiods.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/localhost.cfg $(DESTDIR)$(CFGDIR)/objects/localhost.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/windows.cfg $(DESTDIR)$(CFGDIR)/objects/windows.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/printer.cfg $(DESTDIR)$(CFGDIR)/objects/printer.cfg.CSW
+ @#ginstall -b -m 664 $(WORKSRC)/sample-config/template-object/switch.cfg $(DESTDIR)$(CFGDIR)/objects/switch.cfg.CSW
+ @#
+ @# create user and group -> cswusergroup
+ @#
+ @ginstall -m 755 -d $(DESTDIR)/etc/opt/csw/pkg/CSWnagios
+ @ginstall -m 644 $(FILEDIR)/cswusergroup $(DESTDIR)/etc/opt/csw/pkg/CSWnagios/cswusergroup
+ @#
+ @# end of post-install
+ @#
@$(MAKECOOKIE)
Added: csw/mgar/pkg/nagios/trunk/files/0002-changed-options-for-ginstall.patch
===================================================================
--- csw/mgar/pkg/nagios/trunk/files/0002-changed-options-for-ginstall.patch (rev 0)
+++ csw/mgar/pkg/nagios/trunk/files/0002-changed-options-for-ginstall.patch 2011-06-05 09:03:29 UTC (rev 14710)
@@ -0,0 +1,34 @@
+From 104bbe890512e033db7654c1a0251e9a5a00572a Mon Sep 17 00:00:00 2001
+From: Juergen Arndt <ja at opencsw.org>
+Date: Thu, 21 Apr 2011 15:41:53 +0200
+Subject: [PATCH] changed options for ginstall
+
+---
+ configure | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index 386ed46..db5e00c 100755
+--- a/configure
++++ b/configure
+@@ -6127,7 +6127,7 @@ cat >>confdefs.h <<_ACEOF
+ #define DEFAULT_NAGIOS_GROUP "$nagios_grp"
+ _ACEOF
+
+-INSTALL_OPTS="-o $nagios_user -g $nagios_grp"
++INSTALL_OPTS="-o $install_user -g $install_group"
+
+
+
+@@ -6148,7 +6148,7 @@ fi
+
+
+
+-COMMAND_OPTS="-o $command_user -g $command_grp"
++COMMAND_OPTS="-o $install_user -g $install_group"
+
+
+ MAIL_PROG=no
+--
+1.7.3.2
+
Modified: csw/mgar/pkg/nagios/trunk/files/CSWnagios.postinstall
===================================================================
--- csw/mgar/pkg/nagios/trunk/files/CSWnagios.postinstall 2011-06-04 23:47:35 UTC (rev 14709)
+++ csw/mgar/pkg/nagios/trunk/files/CSWnagios.postinstall 2011-06-05 09:03:29 UTC (rev 14710)
@@ -1,28 +1,58 @@
+ETCSRCDIR=/opt/csw/nagios/etc
+ETCDESTDIR=/etc/opt/csw/nagios
+
+VARSRCDIR=/opt/csw/nagios/var
+VARDESTDIR=/var/opt/csw/nagios
+
#
-# just print out the warning because of the new config directory
+# move contents of olddir to newdir
#
-cat << EOF
+move_contents()
+{
+ olddir=$1
+ newdir=$2
-=======================================================================
+ export olddir
+ export newdir
-From Nagios 3.2.1 on the configuration and log files for this package
-are stored in /etc/opt/csw/nagios/ and /var/opt/csw/nagios/.
+ if [ -x $olddir ]
+ then
+ tar cpf - -C $olddir . | (cd $newdir ; tar xpf -)
+ rm -r $olddir
+ fi
+}
-The standard config files will be moved automatically to the new
-location. Files made by your own will remain in /opt/csw/nagios/etc/
-and have to be moved manually by you.
+#
+# go through all files and set the new path
+#
-Don't forget to change the pathes in your config files. Verify the
-new config with the following command:
+replace_path_in_files()
+{
+ oldpath=$1
+ newpath=$2
+ curpath=$3
- /opt/csw/nagios/bin/nagios -v /etc/opt/csw/nagios/nagios.cfg
+ cd $curpath
+ files=`find ./ -type f`
-You can find additional information at:
+ for file in `echo $files`
+ do
+ cp -p $file $file.tmp
+ cat $file.tmp | sed -e "s;$ETCSRCDIR;$ETCDESTDIR;g" -e "s;$VARSRCDIR;$VARDESTDIR;g" > $file
+ rm $file.tmp
+ done
+}
- http://wiki.opencsw.org/nagios
-=======================================================================
-EOF
+if [ -x $ETCSRCDIR ]
+then
+ move_contents $ETCSRCDIR $ETCDESTDIR
+ replace_path_in_files $ETCSRCDIR $ETCDESTDIR $ETCDESTDIR
+fi
-
+if [ -x $VARSRCDIR ]
+then
+ move_contents $VARSRCDIR $VARDESTDIR
+ replace_path_in_files $VARSRCDIR $VARDESTDIR $VARDESTDIR
+fi
Modified: csw/mgar/pkg/nagios/trunk/files/CSWnagios.preinstall
===================================================================
--- csw/mgar/pkg/nagios/trunk/files/CSWnagios.preinstall 2011-06-04 23:47:35 UTC (rev 14709)
+++ csw/mgar/pkg/nagios/trunk/files/CSWnagios.preinstall 2011-06-05 09:03:29 UTC (rev 14710)
@@ -1,64 +1,39 @@
-# This script exists to make sure the required user
-# accounts nagios and groups nagios, nagioscm exist.
-# 2006-02-27: group nagioscm is required.
-# 2007-09-11 Fix PKG_INSTALL_ROOT usage. BASEDIR is not used for non
-# relocatable packages.
-
-
echo "Executing preinstall"
cat << EOF
=======================================================================
-From Nagios 3.2.1 on the configuration and log files for this package
+From Nagios 3.2.3 on the configuration and log files for this package
are stored in /etc/opt/csw/nagios/ and /var/opt/csw/nagios/.
-The standard config files will be moved automatically to the new
-location. Files made by your own will remain in /opt/csw/nagios/etc/
-and have to be moved manually by you.
+All files under /opt/csw/nagios/etc and /opt/csw/nagios/var will be
+moved automatically to their new locations. All path names in these
+files will be changed accordingly. In case you created files outside
+these directories, please move them manually and check the path names
+in them.
-Don't forget to change the pathes in your config files. Verify the
-new config with the following command:
+If you don't have a backup of your configuration, you might want to
+do it now.
+Please validate the changed configuration with the following command:
+
/opt/csw/nagios/bin/nagios -v /etc/opt/csw/nagios/nagios.cfg
You can find additional information at:
http://wiki.opencsw.org/nagios
- The installation will proceed in 30 seconds.
+ The installation will proceed in 15 seconds.
Press CTRL+C if you want to stop now.
=======================================================================
EOF
-sleep 30
+for i in 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+do
+ printf "$i "
+ sleep 1
+done
-#If installing package on a filesystem tree not running the OS; then exit.
-if [ ! x"$PKG_INSTALL_ROOT" = x"" ] ; then exit 0 ; fi
-
-NAGIOSHOME=/opt/csw/nagios
-
-if [ "$NEEDNAGGROUP" = 1 ] ; then
- echo adding nagios group
- /usr/sbin/groupadd nagios
-fi
-
-if [ "$NEEDNAGUSER" = 1 ] ; then
- echo adding nagios user
- /usr/sbin/useradd -g nagios nagios
- /usr/sbin/usermod -s /bin/false -d $NAGIOSHOME nagios
-else
- echo not adding user
-fi
-
-if [ "$NEEDCMDGROUP" = 1 ] ; then
- echo adding nagioscm group
- /usr/sbin/groupadd nagioscm
- echo adding nagios user to nagioscm group
- /usr/sbin/usermod -G nagioscm nagios
-fi
-
-
-exit 0
+echo
Added: csw/mgar/pkg/nagios/trunk/files/README.CSW
===================================================================
--- csw/mgar/pkg/nagios/trunk/files/README.CSW (rev 0)
+++ csw/mgar/pkg/nagios/trunk/files/README.CSW 2011-06-05 09:03:29 UTC (rev 14710)
@@ -0,0 +1,19 @@
+=======================================================================
+
+From Nagios 3.2.3 on the configuration and log files for this package
+are stored in /etc/opt/csw/nagios/ and /var/opt/csw/nagios/.
+
+All files under /opt/csw/nagios/etc and /opt/csw/nagios/var were moved
+automatically to their new locations. All path names in these files
+were changed accordingly. In case you created files outside these
+directories, please move them manually and check the path names in them.
+
+Please validate the changed configuration with the following command:
+
+ /opt/csw/nagios/bin/nagios -v /etc/opt/csw/nagios/nagios.cfg
+
+You can find additional information at:
+
+ http://wiki.opencsw.org/nagios
+
+=======================================================================
Added: csw/mgar/pkg/nagios/trunk/files/cswusergroup
===================================================================
--- csw/mgar/pkg/nagios/trunk/files/cswusergroup (rev 0)
+++ csw/mgar/pkg/nagios/trunk/files/cswusergroup 2011-06-05 09:03:29 UTC (rev 14710)
@@ -0,0 +1,3 @@
+:nagioscm::::::
+:nagios::::::
+nagios:nagios:Nagios user:/etc/opt/csw/nagios::m:r:NP:nagioscm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list