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