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