wok view nareto/receipt @ rev 11392

Compat: ensure that sqlite genpkg_rules() doesn't return a false failure
author Antoine Bodin <gokhlayeh@slitaz.org>
date Sat Dec 10 05:11:58 2011 +0100 (2011-12-10)
parents
children 3765f181a6d5
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 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.nareto.org/"
10 WGET_URL="${WEB_SITE}srcs/$TARBALL"
11 DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
12 CONFIG_FILES="/etc/nagios"
13 BUGS="s/oreon/centreon/"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 cd $src
19 chown -R www.www *
20 chmod -R 755 *
21 chmod u+x scripts/*.pl
22 }
24 # Rules to gen a SliTaz package suitable for Tazpkg.
25 genpkg_rules()
26 {
27 mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/etc/initcron.d $fs/etc/nagios
29 cp -a $src $fs/usr/share/nareto
30 cp -a stuff/* $fs
31 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php
32 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
33 $fs/usr/share/nareto/index.php \
34 $fs/usr/share/nareto/administration/gestion_auto.php
35 find $fs/usr/share/nareto -type f | while read file; do
36 case "$file" in
37 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
38 esac
39 dos2unix "$file"
40 sed -i 's/<?/<?php /g' "$file"
41 sed -i 's/<?php xml/<?xml/g' "$file"
42 sed -i 's/<?php php/<?php/g' "$file"
43 sed -i 's/<?php =/<?php echo /g' "$file"
44 done
45 mv $fs/usr/share/nareto/include/config.ini.php \
46 $fs/etc/nagios/nareto.init.php
47 ln -s /etc/nagios/nareto.init.php \
48 $fs/usr/share/nareto/include/config.ini.php
49 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
50 $fs/etc/nagios/nareto.init.php
51 chmod 700 $fs/etc/nagios/nareto.init.php
52 cat > $fs/etc/mysql.d/nareto <<EOM
53 #!/bin/sh
55 mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
56 create database nareto;
57 use nareto;
59 \. /usr/share/nareto/scripts/nareto.sql
61 GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
62 FLUSH PRIVILEGES;
64 EOT
65 chmod -x /etc/mysql.d/nareto
66 EOM
67 chmod +x $fs/etc/mysql.d/nareto
68 cat > $fs/etc/initcron.d/nareto <<EOT
69 # Reporting
70 #FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
71 #FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
72 #FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
74 # Suivi des alarmes
75 #FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
76 #FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
78 EOT
79 chmod +x $fs/etc/initcron.d/nareto
81 # Move doc in nareto-doc package.
82 rm -rf $fs/usr/share/nareto/docs
83 }
85 post_install()
86 {
87 [ -s $1/usr/share/nagios/.htaccess ] &&
88 cp $1/usr/share/nagios/.htaccess $1/usr/share/nareto/
89 # Configure lighttpd server
90 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
91 if ! grep -q /usr/share/nareto/ $1/etc/lighttpd/lighttpd.conf; then
92 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/nareto/" => "/usr/share/nareto",|g' -i $1/etc/lighttpd/lighttpd.conf
93 if [ -z "$1" ]; then
94 # Start Web server.
95 /etc/init.d/lighttpd stop
96 /etc/init.d/lighttpd start
97 fi
98 fi
99 fi
101 # Configure apache server
102 if [ -f $1/etc/apache/httpd.conf ]; then
103 sed -i 's/lighttpd/apache/' $1/etc/rcS.conf
104 if [ ! -f $1/etc/apache/conf.d/nareto ]; then
105 cat > $1/etc/apache/conf.d/nareto <<EOT
106 Alias /nareto/ /usr/share/nareto/
107 <Directory "/usr/share/nareto/">
108 Options None
109 AllowOverride AuthConfig
110 Order allow,deny
111 Allow from all
112 </Directory>
113 EOT
114 if [ -z "$1" ]; then
115 # Start Web server.
116 /etc/init.d/apache stop
117 /etc/init.d/apache start
118 fi
119 fi
120 fi
121 }