wok-next view nareto/receipt @ rev 20462

Combine receipts
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Mar 06 03:00:01 2018 +0200 (2018-03-06)
parents c3a368c0cddb
children b278b2018965
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"
19 compile_rules() {
20 chown -R www.www *
21 chmod -R 755 *
22 chmod u+x scripts/*.pl
23 }
25 genpkg_rules() {
26 case $PACKAGE in
27 nareto)
28 mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/etc/initcron.d $fs/etc/nagios
30 cp -a $src $fs/usr/share/nareto
31 cp -a stuff/* $fs
32 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php
33 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
34 $fs/usr/share/nareto/index.php \
35 $fs/usr/share/nareto/administration/gestion_auto.php
36 find $fs/usr/share/nareto -type f \
37 | 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 ;;
86 nareto-doc)
87 mkdir -p $fs/usr/share/nareto
88 cp -a $src/docs $fs/usr/share/nareto
89 CAT="network|documentation"
90 DEPENDS="nareto"
91 ;;
92 esac
93 }
95 post_install_nareto() {
96 [ -s "$1/usr/share/nagios/.htaccess" ] &&
97 cp "$1/usr/share/nagios/.htaccess" "$1/usr/share/nareto/"
99 # Configure lighttpd server
100 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
101 if ! grep -q /usr/share/nareto/ "$1/etc/lighttpd/lighttpd.conf"; then
102 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/nareto/" => "/usr/share/nareto",|g' -i "$1/etc/lighttpd/lighttpd.conf"
103 if [ -z "$1" ]; then
104 # Start Web server.
105 /etc/init.d/lighttpd stop
106 /etc/init.d/lighttpd start
107 fi
108 fi
109 fi
111 # Configure apache server
112 if [ -f "$1/etc/apache/httpd.conf" ]; then
113 sed -i 's/lighttpd/apache/' "$1/etc/rcS.conf"
114 if [ ! -f "$1/etc/apache/conf.d/nareto" ]; then
115 cat > "$1/etc/apache/conf.d/nareto" <<EOT
116 Alias /nareto/ /usr/share/nareto/
117 <Directory "/usr/share/nareto/">
118 Options None
119 AllowOverride AuthConfig
120 Order allow,deny
121 Allow from all
122 </Directory>
123 EOT
124 if [ -z "$1" ]; then
125 # Start Web server.
126 /etc/init.d/apache stop
127 /etc/init.d/apache start
128 fi
129 fi
130 fi
131 }