wok-next view nareto/receipt @ rev 20486

outguess: fix install path
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 12 10:46:52 2018 +0100 (2018-03-12)
parents b278b2018965
children bc02b358e2fa
line source
1 # SliTaz package receipt v2.
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 WEB_SITE="http://www.nareto.org/"
10 BUGS="s/oreon/centreon/"
12 TARBALL="$PACKAGE-$VERSION.tar.gz"
13 WGET_URL="${WEB_SITE}srcs/$TARBALL"
14 CONFIG_FILES="/etc/nagios"
16 DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
17 SPLIT="nareto-doc nareto"
19 compile_rules() {
20 chown -R www.www *
21 chmod -R 755 *
22 chmod u+x scripts/*.pl
24 mkdir -p \
25 $install/usr/share/nareto/ \
26 $install/etc/mysql.d/ \
27 $install/etc/initcron.d/ \
28 $install/etc/nagios/
29 cp -a $src $install/usr/share/nareto/
30 cp -a $stuff/* $install
32 mv $install/usr/share/nareto/include/config.ini.php \
33 $install/etc/nagios/nareto.init.php
34 ln -s /etc/nagios/nareto.init.php \
35 $install/usr/share/nareto/include/config.ini.php
37 cat > $install/etc/mysql.d/nareto <<EOM
38 #!/bin/sh
40 mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
41 create database nareto;
42 use nareto;
44 \. /usr/share/nareto/scripts/nareto.sql
46 GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
47 FLUSH PRIVILEGES;
49 EOT
50 chmod -x /etc/mysql.d/nareto
51 EOM
52 chmod +x $install/etc/mysql.d/nareto
54 cat > $install/etc/initcron.d/nareto <<EOT
55 # Reporting
56 #FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
57 #FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
58 #FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
60 # Suivi des alarmes
61 #FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
62 #FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
64 EOT
65 chmod +x $install/etc/initcron.d/nareto
67 mkdir -p $install/usr/share/nareto
68 cp -a $src/docs $install/usr/share/nareto
69 }
71 genpkg_rules() {
72 case $PACKAGE in
73 nareto-doc)
74 copy docs/
75 CAT="network|documentation"
76 DEPENDS="nareto"
77 ;;
78 nareto)
79 copy @std @rm
80 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php
81 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
82 $fs/usr/share/nareto/index.php \
83 $fs/usr/share/nareto/administration/gestion_auto.php
84 find $fs/usr/share/nareto -type f \
85 | while read file; do
86 case "$file" in
87 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
88 esac
89 dos2unix "$file"
90 sed -i 's/<?/<?php /g' "$file"
91 sed -i 's/<?php xml/<?xml/g' "$file"
92 sed -i 's/<?php php/<?php/g' "$file"
93 sed -i 's/<?php =/<?php echo /g' "$file"
94 done
95 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
96 $fs/etc/nagios/nareto.init.php
97 chmod 700 $fs/etc/nagios/nareto.init.php
98 ;;
99 esac
100 }
102 post_install_nareto() {
103 [ -s "$1/usr/share/nagios/.htaccess" ] &&
104 cp "$1/usr/share/nagios/.htaccess" "$1/usr/share/nareto/"
106 # Configure lighttpd server
107 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
108 if ! grep -q /usr/share/nareto/ "$1/etc/lighttpd/lighttpd.conf"; then
109 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/nareto/" => "/usr/share/nareto",|g' -i "$1/etc/lighttpd/lighttpd.conf"
110 if [ -z "$1" ]; then
111 # Start Web server.
112 /etc/init.d/lighttpd stop
113 /etc/init.d/lighttpd start
114 fi
115 fi
116 fi
118 # Configure apache server
119 if [ -f "$1/etc/apache/httpd.conf" ]; then
120 sed -i 's/lighttpd/apache/' "$1/etc/rcS.conf"
121 if [ ! -f "$1/etc/apache/conf.d/nareto" ]; then
122 cat > "$1/etc/apache/conf.d/nareto" <<EOT
123 Alias /nareto/ /usr/share/nareto/
124 <Directory "/usr/share/nareto/">
125 Options None
126 AllowOverride AuthConfig
127 Order allow,deny
128 Allow from all
129 </Directory>
130 EOT
131 if [ -z "$1" ]; then
132 # Start Web server.
133 /etc/init.d/apache stop
134 /etc/init.d/apache start
135 fi
136 fi
137 fi
138 }