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