wok-next annotate nagvis/receipt @ rev 20179

Up ocsinventory (2.2) opencc (0.4.3)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Nov 02 11:09:53 2017 +0100 (2017-11-02)
parents 3765f181a6d5
children 4d58cc2186c2
rev   line source
pascal@20179 1 # SliTaz package receipt v2.
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
pascal@20179 13 SPLIT="nagvis nagvis-doc nagvis-flex"
erjo@8701 14
erjo@8701 15 # Rules to configure and make the package.
erjo@8701 16 compile_rules()
erjo@8701 17 {
erjo@8701 18 cd $src
erjo@8701 19 }
erjo@8701 20
erjo@8701 21 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@8701 22 genpkg_rules()
erjo@8701 23 {
pascal@20179 24 case $PACKAGE in
pascal@20179 25 nagivs)
pascal@20179 26 SUGGESTED="graphviz"
pascal@20179 27 DEPENDS="nagios php-mysql php-gd ndoutils mk-livestatus"
pascal@20179 28 mkdir -p $fs/usr/share/nagvis \
pascal@20179 29 $fs/etc/apache/conf.d \
pascal@20179 30 $fs/var/lib/nagvis/var/tmpl/cache \
pascal@20179 31 $fs/var/lib/nagvis/var/tmpl/compile \
pascal@20179 32 $fs/usr/share/doc/nagvis
erjo@8701 33
pascal@20179 34 cp -a $src/share $fs/usr/share/nagvis
pascal@20179 35 cp -a $src/etc $fs/etc/nagvis
erjo@8701 36
pascal@20179 37 # copy demo maps.
pascal@20179 38 #~ cp $fs/usr/share/nagios/nagvis/nagvis/images/maps/nagvis-demo.png \
pascal@20179 39 #~ $fs/var/lib/nagvis/automap.png
erjo@8701 40
pascal@20179 41 # link var direcxtory (FHS)
pascal@20179 42 ln -s /var/lib/nagvis/var $fs/usr/share/nagvis/var
erjo@8701 43
pascal@20179 44 # move config files
pascal@20179 45 ln -s /etc/nagvis $fs/usr/share/nagvis/etc
erjo@8701 46
pascal@20179 47 # nagvis config
pascal@20179 48 mv $fs/etc/nagvis/nagvis.ini.php-sample $fs/etc/nagvis/nagvis.ini.php
pascal@20179 49 sed -i -e 's|;language=|language=|' \
pascal@20179 50 -e 's|;dateformat="Y-m-d H:i:s"|dateformat="d-m-Y H:i:s"|' \
pascal@20179 51 -e 's|;base=.*|base="/usr/share/nagvis/"|' \
pascal@20179 52 -e 's|;htmlbase=|htmlbase=|' \
pascal@20179 53 -e 's|;htmlcgi=|htmlcgi=|' \
pascal@20179 54 -e 's|;backendtype=|backendtype=|' \
pascal@20179 55 -e 's|;dbhost=|dbhost=|' \
pascal@20179 56 -e 's|;dbport=|dbport=|' \
pascal@20179 57 -e 's|;dbname=|dbname=|' \
pascal@20179 58 -e 's|;dbname=|dbname=|' \
pascal@20179 59 -e 's|;dbuser=|dbuser=|' \
pascal@20179 60 -e 's|;dbpass=""|dbpass=|' \
pascal@20179 61 -e 's|;dbprefix=|dbprefix=|' \
pascal@20179 62 -e 's|;dbinstancename=|dbinstancename=|' \
pascal@20179 63 $fs/etc/nagvis/nagvis.ini.php
erjo@8701 64
pascal@20179 65 sed -i -e '/;logonmodule=/ {
pascal@20179 66 a\logonmodule="LogonEnv"\
erjo@8701 67 logonenvvar="REMOTE_USER"\
erjo@8701 68 logonenvcreateuser="0"
pascal@20179 69 }' $fs/etc/nagvis/nagvis.ini.php
pascal@20179 70 sed -i -e '/;socket/ a\socket="unix:/var/lib/nagios/rw/live"' $fs/etc/nagvis/nagvis.ini.php
pascal@20179 71 sed -i -e 's/;showautomaps=1/showautomaps=0/' $fs/etc/nagvis/nagvis.ini.php
erjo@8701 72
pascal@20179 73 # Apache config
pascal@20179 74 mv $fs/etc/nagvis/apache2-nagvis.conf-sample $fs/etc/nagvis/apache2-nagvis.conf
pascal@20179 75 ln -s /etc/nagvis/apache2-nagvis.conf $fs/etc/apache/conf.d/nagvis.conf
pascal@20179 76 sed -i -e 's|@NAGVIS_WEB@|/nagvis|' \
pascal@20179 77 -e 's|@NAGVIS_PATH@|/usr/share/nagvis|' \
pascal@20179 78 -e 's|#AuthName|AuthName|' \
pascal@20179 79 -e 's|#AuthType|AuthType|' \
pascal@20179 80 -e 's|#AuthUserFile|AuthUserFile|' \
pascal@20179 81 -e 's|@NAGIOS_PATH@.*|/etc/nagios/htpasswd.users|' \
pascal@20179 82 -e 's| #Require|Require|' $fs/etc/nagvis/apache2-nagvis.conf
erjo@8701 83
pascal@20179 84 # Fix perms
pascal@20179 85 chown -R www.www $fs/usr/share/nagvis $fs/var/lib/nagvis
pascal@20179 86 chown -R root.www $fs/etc/nagvis
erjo@8701 87
pascal@20179 88 chmod 664 $fs/etc/nagvis/nagvis.ini.php
pascal@20179 89 chmod 775 $fs/etc/nagvis/maps
pascal@20179 90 chmod 664 $fs/etc/nagvis/maps/*
pascal@20179 91 chmod 664 $fs/etc/nagvis/geomap/*
pascal@20179 92 chmod 664 $fs/etc/nagvis/automaps/*
pascal@20179 93 chmod 775 $fs/var/lib/nagvis
erjo@8701 94
pascal@20179 95 # Cleanup
pascal@20179 96 rm -f $fs/usr/share/nagvis/install.*
pascal@20179 97 rm -f $fs/usr/share/nagvis/share/uifx
erjo@8701 98
pascal@20179 99 mv $fs/usr/share/nagvis/share/userfiles/images/maps $fs/var/lib/nagvis
pascal@20179 100 chmod 775 $fs/var/lib/nagvis/maps
pascal@20179 101 chmod 664 $fs/var/lib/nagvis/maps/*
pascal@20179 102 ln -s /var/lib/nagvis/maps $fs/usr/share/nagvis/share/userfiles/images/
pascal@20179 103 ;;
pascal@20179 104 nagvis-doc)
pascal@20179 105 CAT="network|Nagvis documentation and licence"
pascal@20179 106 DEPENDS="nagvis"
pascal@20179 107 mkdir -p $fs/usr/share/doc/nagvis \
pascal@20179 108 $fs/usr/share/nagvis
pascal@20179 109
pascal@20179 110 # Copy doc and licence
pascal@20179 111 cp -a $src/INSTALL $fs/usr/share/doc/nagvis
pascal@20179 112 cp -a $src/LICENCE $fs/usr/share/doc/nagvis
pascal@20179 113 cp -a $src/README $fs/usr/share/doc/nagvis
pascal@20179 114 cp -a $src/ChangeLog $fs/usr/share/doc/nagvis
pascal@20179 115 cp -pa $src/docs $fs/usr/share/nagvis
pascal@20179 116 ;;
pascal@20179 117 nagvis-flex)
pascal@20179 118 CAT="network|Nagvis Flex"
pascal@20179 119 DEPENDS="nagvis"
pascal@20179 120 mkdir -p $fs/usr/share/nagvis
pascal@20179 121
pascal@20179 122 # Copy doc and licence
pascal@20179 123 cp -a $src/uifx $fs/usr/share/nagvis
pascal@20179 124 ;;
pascal@20179 125 esac
erjo@8701 126 }
erjo@8701 127
pascal@20179 128 post_install_nagvis()
erjo@8701 129 {
erjo@8701 130 cat <<EOT
erjo@8701 131 Now visit http://localhost/nagvis
erjo@8701 132 EOT
erjo@8701 133 if [ -z "$1" ]; then
erjo@8701 134 /etc/init.d/nagios stop
erjo@8701 135 /etc/init.d/nagios start
erjo@8701 136 fi
erjo@8701 137 }