wok-next annotate nagvis/receipt @ rev 8701

add: nagvis{-doc,-flex}
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Feb 17 23:11:32 2011 +0100 (2011-02-17)
parents
children bb34bab08c6e
rev   line source
erjo@8701 1 # SliTaz package receipt.
erjo@8701 2
erjo@8701 3 PACKAGE="nagvis"
erjo@8701 4 VERSION="1.5.7"
erjo@8701 5 CATEGORY="network"
erjo@8701 6 SHORT_DESC="Visualization addon for nagios."
erjo@8701 7 MAINTAINER="erjo@slitaz.org"
erjo@8701 8 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8701 9 WEB_SITE="http://www.nagvis.org/"
erjo@8701 10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
erjo@8701 11 DEPENDS="nagios php-mysql php-gd ndoutils mk-livestatus"
erjo@8701 12 SUGGESTED="graphviz"
erjo@8701 13
erjo@8701 14 # Rules to configure and make the package.
erjo@8701 15 compile_rules()
erjo@8701 16 {
erjo@8701 17 cd $src
erjo@8701 18 }
erjo@8701 19
erjo@8701 20 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@8701 21 genpkg_rules()
erjo@8701 22 {
erjo@8701 23 mkdir -p $fs/usr/share/nagvis \
erjo@8701 24 $fs/etc/apache/conf.d \
erjo@8701 25 $fs/var/lib/nagvis/var/tmpl/cache \
erjo@8701 26 $fs/var/lib/nagvis/var/tmpl/compile \
erjo@8701 27 $fs/usr/share/doc/nagvis
erjo@8701 28
erjo@8701 29 cp -a $src/share $fs/usr/share/nagvis
erjo@8701 30 cp -a $src/etc $fs/etc/nagvis
erjo@8701 31
erjo@8701 32 # copy demo maps.
erjo@8701 33 #~ cp $fs/usr/share/nagios/nagvis/nagvis/images/maps/nagvis-demo.png \
erjo@8701 34 #~ $fs/var/lib/nagvis/automap.png
erjo@8701 35
erjo@8701 36 # link var direcxtory (FHS)
erjo@8701 37 ln -s /var/lib/nagvis/var $fs/usr/share/nagvis/var
erjo@8701 38
erjo@8701 39 # move config files
erjo@8701 40 ln -s /etc/nagvis $fs/usr/share/nagvis/etc
erjo@8701 41
erjo@8701 42 # nagvis config
erjo@8701 43 mv $fs/etc/nagvis/nagvis.ini.php-sample $fs/etc/nagvis/nagvis.ini.php
erjo@8701 44 sed -i -e 's|;language=|language=|' \
erjo@8701 45 -e 's|;dateformat="Y-m-d H:i:s"|dateformat="d-m-Y H:i:s"|' \
erjo@8701 46 -e 's|;base=.*|base="/usr/share/nagvis/"|' \
erjo@8701 47 -e 's|;htmlbase=|htmlbase=|' \
erjo@8701 48 -e 's|;htmlcgi=|htmlcgi=|' \
erjo@8701 49 -e 's|;backendtype=|backendtype=|' \
erjo@8701 50 -e 's|;dbhost=|dbhost=|' \
erjo@8701 51 -e 's|;dbport=|dbport=|' \
erjo@8701 52 -e 's|;dbname=|dbname=|' \
erjo@8701 53 -e 's|;dbname=|dbname=|' \
erjo@8701 54 -e 's|;dbuser=|dbuser=|' \
erjo@8701 55 -e 's|;dbpass=""|dbpass=|' \
erjo@8701 56 -e 's|;dbprefix=|dbprefix=|' \
erjo@8701 57 -e 's|;dbinstancename=|dbinstancename=|' \
erjo@8701 58 $fs/etc/nagvis/nagvis.ini.php
erjo@8701 59
erjo@8701 60 sed -i -e '/;logonmodule=/ {
erjo@8701 61 a\logonmodule="LogonEnv"\
erjo@8701 62 logonenvvar="REMOTE_USER"\
erjo@8701 63 logonenvcreateuser="0"
erjo@8701 64 }' $fs/etc/nagvis/nagvis.ini.php
erjo@8701 65 sed -i -e '/;socket/ a\socket="unix:/var/lib/nagios/rw/live"' $fs/etc/nagvis/nagvis.ini.php
erjo@8701 66 sed -i -e 's/;showautomaps=1/showautomaps=0/"' $fs/etc/nagvis/nagvis.ini.php
erjo@8701 67
erjo@8701 68 # Apache config
erjo@8701 69 mv $fs/etc/nagvis/apache2-nagvis.conf-sample $fs/etc/nagvis/apache2-nagvis.conf
erjo@8701 70 ln -s /etc/nagvis/apache2-nagvis.conf $fs/etc/apache/conf.d/nagvis.conf
erjo@8701 71 sed -i -e 's|@NAGVIS_WEB@|/nagvis|' \
erjo@8701 72 -e 's|@NAGVIS_PATH@|/usr/share/nagvis|' \
erjo@8701 73 -e 's|#AuthName|AuthName|' \
erjo@8701 74 -e 's|#AuthType|AuthType|' \
erjo@8701 75 -e 's|#AuthUserFile|AuthUserFile|' \
erjo@8701 76 -e 's|@NAGIOS_PATH@.*|/etc/nagios/htpasswd.users|' \
erjo@8701 77 -e 's| #Require|Require|' $fs/etc/nagvis/apache2-nagvis.conf
erjo@8701 78
erjo@8701 79 # Fix perms
erjo@8701 80 chown -R www.www $fs/usr/share/nagvis $fs/var/lib/nagvis
erjo@8701 81 chown -R root.www $fs/etc/nagvis
erjo@8701 82
erjo@8701 83 chmod 664 $fs/etc/nagvis/nagvis.ini.php
erjo@8701 84 chmod 775 $fs/etc/nagvis/maps
erjo@8701 85 chmod 664 $fs/etc/nagvis/maps/*
erjo@8701 86 chmod 664 $fs/etc/nagvis/geomap/*
erjo@8701 87 chmod 664 $fs/etc/nagvis/automaps/*
erjo@8701 88 chmod 775 $fs/var/lib/nagvis
erjo@8701 89
erjo@8701 90 # Cleanup
erjo@8701 91 rm -f $fs/usr/share/nagvis/install.*
erjo@8701 92 rm -f $fs/usr/share/nagvis/share/uifx
erjo@8701 93
erjo@8701 94 mv $fs/usr/share/nagvis/share/userfiles/images/maps $fs/var/lib/nagvis
erjo@8701 95 chmod 775 $fs/var/lib/nagvis/maps
erjo@8701 96 chmod 664 $fs/var/lib/nagvis/maps/*
erjo@8701 97 ln -s /var/lib/nagvis/maps $fs/usr/share/nagvis/share/userfiles/images/
erjo@8701 98
erjo@8701 99 }
erjo@8701 100
erjo@8701 101 post_install()
erjo@8701 102 {
erjo@8701 103 cat <<EOT
erjo@8701 104 Now visit http://localhost/nagvis
erjo@8701 105 EOT
erjo@8701 106 if [ -z "$1" ]; then
erjo@8701 107 /etc/init.d/nagios stop
erjo@8701 108 /etc/init.d/nagios start
erjo@8701 109 fi
erjo@8701 110 }