wok-current view nagvis/receipt @ rev 25685
Add checkspace / fetchall feature for tazpkg
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Thu Mar 14 20:28:39 2024 +0000 (8 months ago) |
parents | ad8b9ff412d2 |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="nagvis"
4 VERSION="1.9.31"
5 CATEGORY="network"
6 SHORT_DESC="Visualization addon for nagios."
7 MAINTAINER="erjo@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://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 # What is the latest version available today?
18 current_version()
19 {
20 wget -O - $WEB_SITE 2>/dev/null | \
21 sed '/has been released/!d;s|.*NagVis ||;s| has been.*||;q'
22 }
24 # Rules to gen a SliTaz package suitable for Tazpkg.
25 genpkg_rules()
26 {
27 mkdir -p $fs/usr/share/nagvis
28 mkdir -p $fs/etc/apache/conf.d
29 mkdir -p $fs/var/lib/nagvis/var/tmpl/cache
30 mkdir -p $fs/var/lib/nagvis/var/tmpl/compile
31 mkdir -p $fs/usr/share/doc/nagvis
33 cp -a $src/share $fs/usr/share/nagvis
34 cp -a $src/etc $fs/etc/nagvis
36 # copy demo maps.
37 #~ cp $fs/usr/share/nagios/nagvis/nagvis/images/maps/nagvis-demo.png \
38 #~ $fs/var/lib/nagvis/automap.png
40 # link var directory (FHS)
41 ln -s /var/lib/nagvis/var $fs/usr/share/nagvis/var
43 # move configuration files
44 ln -s /etc/nagvis $fs/usr/share/nagvis/etc
46 # nagvis configuration
47 mv $fs/etc/nagvis/nagvis.ini.php-sample $fs/etc/nagvis/nagvis.ini.php
48 sed -i -e 's|;language=|language=|' \
49 -e 's|;dateformat="Y-m-d H:i:s"|dateformat="d-m-Y H:i:s"|' \
50 -e 's|;base=.*|base="/usr/share/nagvis/"|' \
51 -e 's|;htmlbase=|htmlbase=|' \
52 -e 's|;htmlcgi=|htmlcgi=|' \
53 -e 's|;backendtype=|backendtype=|' \
54 -e 's|;dbhost=|dbhost=|' \
55 -e 's|;dbport=|dbport=|' \
56 -e 's|;dbname=|dbname=|' \
57 -e 's|;dbname=|dbname=|' \
58 -e 's|;dbuser=|dbuser=|' \
59 -e 's|;dbpass=""|dbpass=|' \
60 -e 's|;dbprefix=|dbprefix=|' \
61 -e 's|;dbinstancename=|dbinstancename=|' \
62 $fs/etc/nagvis/nagvis.ini.php
64 sed -i -e '/;logonmodule=/ {
65 a\logonmodule="LogonEnv"\
66 logonenvvar="REMOTE_USER"\
67 logonenvcreateuser="0"
68 }' $fs/etc/nagvis/nagvis.ini.php
69 sed -i -e '/;socket/ a\socket="unix:/var/lib/nagios/rw/live"' \
70 $fs/etc/nagvis/nagvis.ini.php
71 sed -i -e 's/;showautomaps=1/showautomaps=0/' \
72 $fs/etc/nagvis/nagvis.ini.php
74 # Apache configuration
75 mv $fs/etc/nagvis/apache2-nagvis.conf-sample \
76 $fs/etc/nagvis/apache2-nagvis.conf
77 ln -s /etc/nagvis/apache2-nagvis.conf \
78 $fs/etc/apache/conf.d/nagvis.conf
79 sed -i -e 's|@NAGVIS_WEB@|/nagvis|' \
80 -e 's|@NAGVIS_PATH@|/usr/share/nagvis|' \
81 -e 's|#AuthName|AuthName|' \
82 -e 's|#AuthType|AuthType|' \
83 -e 's|#AuthUserFile|AuthUserFile|' \
84 -e 's|@NAGIOS_PATH@.*|/etc/nagios/htpasswd.users|' \
85 -e 's| #Require|Require|' \
86 $fs/etc/nagvis/apache2-nagvis.conf
88 # Fix permissions
89 chown -R www.www $fs/usr/share/nagvis
90 chown -R www.www $fs/var/lib/nagvis
91 chown -R root.www $fs/etc/nagvis
93 chmod 664 $fs/etc/nagvis/nagvis.ini.php
94 chmod 775 $fs/etc/nagvis/maps
95 chmod 664 $fs/etc/nagvis/maps/*
96 chmod 664 $fs/etc/nagvis/geomap/*
97 # chmod 664 $fs/etc/nagvis/automaps/*
98 chmod 775 $fs/var/lib/nagvis
100 # Cleanup
101 rm -f $fs/usr/share/nagvis/install.*
102 rm -f $fs/usr/share/nagvis/share/uifx
104 mv $fs/usr/share/nagvis/share/userfiles/images/maps \
105 $fs/var/lib/nagvis
106 chmod 775 $fs/var/lib/nagvis/maps
107 chmod 664 $fs/var/lib/nagvis/maps/*
108 ln -s /var/lib/nagvis/maps \
109 $fs/usr/share/nagvis/share/userfiles/images/
110 }
112 post_install()
113 {
114 cat <<EOT
115 Now visit http://localhost/nagvis
116 EOT
117 if [ -z "$1" ]
118 then
119 /etc/init.d/nagios stop
120 /etc/init.d/nagios start
121 fi
122 }