wok-6.x annotate nareto/receipt @ rev 19059

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