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