wok annotate nagvis/receipt @ rev 20145

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