wok-6.x view nareto/receipt @ rev 16410
Up: ntfs-3g (2014.2.15)
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Thu Apr 17 11:09:07 2014 +0400 (2014-04-17) |
parents | 2b32764afdc5 |
children | 9e01bc6321ea |
line source
1 # SliTaz package receipt.
3 PACKAGE="nareto"
4 VERSION="1.1.6"
5 CATEGORY="network"
6 SHORT_DESC="Nagios reporting tool."
7 MAINTAINER="erjo@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.nareto.org/"
11 WGET_URL="${WEB_SITE}srcs/$TARBALL"
12 CONFIG_FILES="/etc/nagios"
13 BUGS="s/oreon/centreon/"
15 DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
20 cd $src
21 chown -R www.www *
22 chmod -R 755 *
23 chmod u+x scripts/*.pl
24 }
26 # Rules to gen a SliTaz package suitable for Tazpkg.
27 genpkg_rules()
28 {
29 mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/etc/initcron.d $fs/etc/nagios
31 cp -a $src $fs/usr/share/nareto
32 cp -a stuff/* $fs
33 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php
34 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
35 $fs/usr/share/nareto/index.php \
36 $fs/usr/share/nareto/administration/gestion_auto.php
37 find $fs/usr/share/nareto -type f | while read file; do
38 case "$file" in
39 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
40 esac
41 dos2unix "$file"
42 sed -i 's/<?/<?php /g' "$file"
43 sed -i 's/<?php xml/<?xml/g' "$file"
44 sed -i 's/<?php php/<?php/g' "$file"
45 sed -i 's/<?php =/<?php echo /g' "$file"
46 done
47 mv $fs/usr/share/nareto/include/config.ini.php \
48 $fs/etc/nagios/nareto.init.php
49 ln -s /etc/nagios/nareto.init.php \
50 $fs/usr/share/nareto/include/config.ini.php
51 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
52 $fs/etc/nagios/nareto.init.php
53 chmod 700 $fs/etc/nagios/nareto.init.php
54 cat > $fs/etc/mysql.d/nareto <<EOM
55 #!/bin/sh
57 mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
58 create database nareto;
59 use nareto;
61 \. /usr/share/nareto/scripts/nareto.sql
63 GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
64 FLUSH PRIVILEGES;
66 EOT
67 chmod -x /etc/mysql.d/nareto
68 EOM
69 chmod +x $fs/etc/mysql.d/nareto
70 cat > $fs/etc/initcron.d/nareto <<EOT
71 # Reporting
72 #FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
73 #FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
74 #FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
76 # Suivi des alarmes
77 #FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
78 #FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
80 EOT
81 chmod +x $fs/etc/initcron.d/nareto
83 # Move doc in nareto-doc package.
84 rm -rf $fs/usr/share/nareto/docs
85 }
87 post_install()
88 {
89 [ -s $1/usr/share/nagios/.htaccess ] &&
90 cp $1/usr/share/nagios/.htaccess $1/usr/share/nareto/
91 # Configure lighttpd server
92 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
93 if ! grep -q /usr/share/nareto/ $1/etc/lighttpd/lighttpd.conf; then
94 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/nareto/" => "/usr/share/nareto",|g' -i $1/etc/lighttpd/lighttpd.conf
95 if [ -z "$1" ]; then
96 # Start Web server.
97 /etc/init.d/lighttpd stop
98 /etc/init.d/lighttpd start
99 fi
100 fi
101 fi
103 # Configure apache server
104 if [ -f $1/etc/apache/httpd.conf ]; then
105 sed -i 's/lighttpd/apache/' $1/etc/rcS.conf
106 if [ ! -f $1/etc/apache/conf.d/nareto ]; then
107 cat > $1/etc/apache/conf.d/nareto <<EOT
108 Alias /nareto/ /usr/share/nareto/
109 <Directory "/usr/share/nareto/">
110 Options None
111 AllowOverride AuthConfig
112 Order allow,deny
113 Allow from all
114 </Directory>
115 EOT
116 if [ -z "$1" ]; then
117 # Start Web server.
118 /etc/init.d/apache stop
119 /etc/init.d/apache start
120 fi
121 fi
122 fi
123 }