wok-6.x annotate nagvis/receipt @ rev 22822

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