wok-next view nareto/receipt @ rev 20768

cookutils: up (1068); nareto: pack all the files
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jun 06 13:33:47 2018 +0300 (2018-06-06)
parents d43bf7aae921
children d5aab818505e
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/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="${WEB_SITE}srcs/$TARBALL"
14 SPLIT="nareto-doc nareto"
16 BUGS="s/oreon/centreon/"
18 compile_rules() {
19 chown -R www.www *
20 chmod -R 755 *
21 chmod u+x scripts/*.pl
23 mkdir -p \
24 $install/usr/share/nareto/ \
25 $install/etc/mysql.d/ \
26 $install/etc/initcron.d/ \
27 $install/etc/nagios/
28 cp -a $src $install/usr/share/nareto/
29 cp -a $stuff/* $install
31 mv $install/usr/share/nareto/nareto-$VERSION/include/config.ini.php \
32 $install/etc/nagios/nareto.init.php
33 ln -s /etc/nagios/nareto.init.php \
34 $install/usr/share/nareto/nareto-$VERSION/include/config.ini.php
36 cat > $install/etc/mysql.d/nareto <<EOM
37 #!/bin/sh
39 mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
40 create database nareto;
41 use nareto;
43 \. /usr/share/nareto/scripts/nareto.sql
45 GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
46 FLUSH PRIVILEGES;
48 EOT
49 chmod -x /etc/mysql.d/nareto
50 EOM
51 chmod +x $install/etc/mysql.d/nareto
53 cat > $install/etc/initcron.d/nareto <<EOT
54 # Reporting
55 #FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
56 #FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
57 #FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
59 # Suivi des alarmes
60 #FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
61 #FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
63 EOT
64 chmod +x $install/etc/initcron.d/nareto
66 mkdir -p $install/usr/share/nareto
67 cp -a $src/docs $install/usr/share/nareto
68 }
70 genpkg_rules() {
71 case $PACKAGE in
72 nareto-doc)
73 copy docs/
74 CAT="network|documentation"
75 DEPENDS="nareto"
76 ;;
77 nareto)
78 copy @std @rm include/ # usually include/ belongs to @dev
79 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/nareto-$VERSION/index.php
80 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
81 $fs/usr/share/nareto/nareto-$VERSION/index.php \
82 $fs/usr/share/nareto/nareto-$VERSION/administration/gestion_auto.php
83 find $fs/usr/share/nareto -type f \
84 | while read file; do
85 case "$file" in
86 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
87 esac
88 dos2unix "$file"
89 sed -i 's/<?/<?php /g' "$file"
90 sed -i 's/<?php xml/<?xml/g' "$file"
91 sed -i 's/<?php php/<?php/g' "$file"
92 sed -i 's/<?php =/<?php echo /g' "$file"
93 done
94 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
95 $fs/etc/nagios/nareto.init.php
96 chmod 700 $fs/etc/nagios/nareto.init.php
97 DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
98 CONFIG_FILES="/etc/nagios"
99 ;;
100 esac
101 }
103 post_install_nareto() {
104 [ -s "$1/usr/share/nagios/.htaccess" ] &&
105 cp "$1/usr/share/nagios/.htaccess" "$1/usr/share/nareto/"
107 # Configure lighttpd server
108 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
109 if ! grep -q /usr/share/nareto/ "$1/etc/lighttpd/lighttpd.conf"; then
110 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/nareto/" => "/usr/share/nareto",|g' -i "$1/etc/lighttpd/lighttpd.conf"
111 if [ -z "$1" ]; then
112 # Start Web server.
113 /etc/init.d/lighttpd stop
114 /etc/init.d/lighttpd start
115 fi
116 fi
117 fi
119 # Configure apache server
120 if [ -f "$1/etc/apache/httpd.conf" ]; then
121 sed -i 's/lighttpd/apache/' "$1/etc/rcS.conf"
122 if [ ! -f "$1/etc/apache/conf.d/nareto" ]; then
123 cat > "$1/etc/apache/conf.d/nareto" <<EOT
124 Alias /nareto/ /usr/share/nareto/
125 <Directory "/usr/share/nareto/">
126 Options None
127 AllowOverride AuthConfig
128 Order allow,deny
129 Allow from all
130 </Directory>
131 EOT
132 if [ -z "$1" ]; then
133 # Start Web server.
134 /etc/init.d/apache stop
135 /etc/init.d/apache start
136 fi
137 fi
138 fi
139 }