SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "nagvis"

# SliTaz package receipt.

PACKAGE="nagvis"
VERSION="1.5.7"
CATEGORY="network"
SHORT_DESC="Visualization addon for nagios."
MAINTAINER="erjo@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.nagvis.org/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
DEPENDS="nagios php-mysql php-gd ndoutils mk-livestatus"
SUGGESTED="graphviz"

# Rules to configure and make the package.
compile_rules()
{
    cd $src
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/nagvis \
        $fs/etc/apache/conf.d \
        $fs/var/lib/nagvis/var/tmpl/cache \
        $fs/var/lib/nagvis/var/tmpl/compile \
        $fs/usr/share/doc/nagvis
    
    cp -a $src/share $fs/usr/share/nagvis
    cp -a $src/etc $fs/etc/nagvis
    
    # copy demo maps.
    #~ cp $fs/usr/share/nagios/nagvis/nagvis/images/maps/nagvis-demo.png \
        #~ $fs/var/lib/nagvis/automap.png
    
    # link  var direcxtory (FHS)    
    ln -s /var/lib/nagvis/var  $fs/usr/share/nagvis/var
    
    # move config files
    ln -s /etc/nagvis $fs/usr/share/nagvis/etc
    
    # nagvis config
    mv $fs/etc/nagvis/nagvis.ini.php-sample $fs/etc/nagvis/nagvis.ini.php
    sed -i  -e 's|;language=|language=|' \
        -e 's|;dateformat="Y-m-d H:i:s"|dateformat="d-m-Y H:i:s"|' \
        -e 's|;base=.*|base="/usr/share/nagvis/"|' \
        -e 's|;htmlbase=|htmlbase=|' \
        -e 's|;htmlcgi=|htmlcgi=|' \
        -e 's|;backendtype=|backendtype=|' \
        -e 's|;dbhost=|dbhost=|' \
        -e 's|;dbport=|dbport=|' \
        -e 's|;dbname=|dbname=|' \
        -e 's|;dbname=|dbname=|' \
        -e 's|;dbuser=|dbuser=|' \
        -e 's|;dbpass=""|dbpass=|' \
        -e 's|;dbprefix=|dbprefix=|' \
        -e 's|;dbinstancename=|dbinstancename=|' \
        $fs/etc/nagvis/nagvis.ini.php
    
    sed -i -e '/;logonmodule=/ {
        a\logonmodule="LogonEnv"\
logonenvvar="REMOTE_USER"\
logonenvcreateuser="0"
    }' $fs/etc/nagvis/nagvis.ini.php
    sed -i -e '/;socket/ a\socket="unix:/var/lib/nagios/rw/live"' $fs/etc/nagvis/nagvis.ini.php
    sed -i -e 's/;showautomaps=1/showautomaps=0/' $fs/etc/nagvis/nagvis.ini.php
    
    # Apache config
    mv $fs/etc/nagvis/apache2-nagvis.conf-sample $fs/etc/nagvis/apache2-nagvis.conf
    ln -s /etc/nagvis/apache2-nagvis.conf $fs/etc/apache/conf.d/nagvis.conf
    sed -i -e 's|@NAGVIS_WEB@|/nagvis|' \
        -e 's|@NAGVIS_PATH@|/usr/share/nagvis|' \
        -e 's|#AuthName|AuthName|' \
        -e 's|#AuthType|AuthType|' \
        -e 's|#AuthUserFile|AuthUserFile|' \
        -e 's|@NAGIOS_PATH@.*|/etc/nagios/htpasswd.users|' \
        -e 's| #Require|Require|' $fs/etc/nagvis/apache2-nagvis.conf
    
    # Fix perms
    chown -R www.www $fs/usr/share/nagvis $fs/var/lib/nagvis
    chown -R root.www $fs/etc/nagvis
    
    chmod 664 $fs/etc/nagvis/nagvis.ini.php  
    chmod 775 $fs/etc/nagvis/maps
    chmod 664 $fs/etc/nagvis/maps/*
    chmod 664 $fs/etc/nagvis/geomap/*
    chmod 664 $fs/etc/nagvis/automaps/*
    chmod 775 $fs/var/lib/nagvis

    # Cleanup
    rm -f $fs/usr/share/nagvis/install.*
    rm -f $fs/usr/share/nagvis/share/uifx
    
    mv $fs/usr/share/nagvis/share/userfiles/images/maps $fs/var/lib/nagvis
    chmod 775 $fs/var/lib/nagvis/maps
    chmod 664 $fs/var/lib/nagvis/maps/*
    ln -s /var/lib/nagvis/maps $fs/usr/share/nagvis/share/userfiles/images/

}

post_install()
{
    cat <<EOT
Now visit http://localhost/nagvis
EOT
    if [ -z "$1" ]; then
        /etc/init.d/nagios stop
        /etc/init.d/nagios start
    fi
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)