wok-next annotate nareto/receipt @ rev 20490

nareto: update index.php path (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 12 11:53:39 2018 +0100 (2018-03-12)
parents 9d91537b9fb2
children d43bf7aae921
rev   line source
al@20456 1 # SliTaz package receipt v2.
erjo@8704 2
erjo@8704 3 PACKAGE="nareto"
erjo@8704 4 VERSION="1.1.6"
erjo@8704 5 CATEGORY="network"
al@20456 6 SHORT_DESC="Nagios reporting tool"
erjo@8704 7 MAINTAINER="erjo@slitaz.org"
pascal@15584 8 LICENSE="GPL2"
al@20456 9 WEB_SITE="http://www.nareto.org/"
al@20456 10 BUGS="s/oreon/centreon/"
al@20456 11
erjo@8704 12 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8704 13 WGET_URL="${WEB_SITE}srcs/$TARBALL"
erjo@8704 14 CONFIG_FILES="/etc/nagios"
erjo@8704 15
pascal@15584 16 DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
al@20481 17 SPLIT="nareto-doc nareto"
pascal@15584 18
al@20456 19 compile_rules() {
erjo@8704 20 chown -R www.www *
erjo@8704 21 chmod -R 755 *
erjo@8704 22 chmod u+x scripts/*.pl
al@20481 23
al@20481 24 mkdir -p \
al@20481 25 $install/usr/share/nareto/ \
al@20481 26 $install/etc/mysql.d/ \
al@20481 27 $install/etc/initcron.d/ \
al@20481 28 $install/etc/nagios/
al@20481 29 cp -a $src $install/usr/share/nareto/
pascal@20483 30 cp -a $stuff/* $install
al@20481 31
pascal@20487 32 mv $install/usr/share/nareto/nareto-$VERSION/include/config.ini.php \
al@20481 33 $install/etc/nagios/nareto.init.php
al@20481 34 ln -s /etc/nagios/nareto.init.php \
pascal@20487 35 $install/usr/share/nareto/nareto-$VERSION/include/config.ini.php
al@20481 36
al@20481 37 cat > $install/etc/mysql.d/nareto <<EOM
al@20481 38 #!/bin/sh
al@20481 39
al@20481 40 mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
al@20481 41 create database nareto;
al@20481 42 use nareto;
al@20481 43
al@20481 44 \. /usr/share/nareto/scripts/nareto.sql
al@20481 45
al@20481 46 GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
al@20481 47 FLUSH PRIVILEGES;
al@20481 48
al@20481 49 EOT
al@20481 50 chmod -x /etc/mysql.d/nareto
al@20481 51 EOM
al@20481 52 chmod +x $install/etc/mysql.d/nareto
al@20481 53
al@20481 54 cat > $install/etc/initcron.d/nareto <<EOT
al@20481 55 # Reporting
al@20481 56 #FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
al@20481 57 #FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
al@20481 58 #FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
al@20481 59
al@20481 60 # Suivi des alarmes
al@20481 61 #FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
al@20481 62 #FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
al@20481 63
al@20481 64 EOT
al@20481 65 chmod +x $install/etc/initcron.d/nareto
al@20481 66
al@20481 67 mkdir -p $install/usr/share/nareto
al@20481 68 cp -a $src/docs $install/usr/share/nareto
erjo@8704 69 }
erjo@8704 70
al@20456 71 genpkg_rules() {
al@20456 72 case $PACKAGE in
al@20481 73 nareto-doc)
al@20481 74 copy docs/
al@20481 75 CAT="network|documentation"
al@20481 76 DEPENDS="nareto"
al@20481 77 ;;
al@20456 78 nareto)
al@20481 79 copy @std @rm
pascal@20490 80 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/nareto-$VERSION/index.php
al@20456 81 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
pascal@20489 82 $fs/usr/share/nareto/nareto-$VERSION/index.php \
pascal@20489 83 $fs/usr/share/nareto/nareto-$VERSION/administration/gestion_auto.php
al@20456 84 find $fs/usr/share/nareto -type f \
al@20456 85 | while read file; do
al@20456 86 case "$file" in
al@20456 87 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
al@20456 88 esac
al@20456 89 dos2unix "$file"
al@20456 90 sed -i 's/<?/<?php /g' "$file"
al@20456 91 sed -i 's/<?php xml/<?xml/g' "$file"
al@20456 92 sed -i 's/<?php php/<?php/g' "$file"
al@20456 93 sed -i 's/<?php =/<?php echo /g' "$file"
al@20456 94 done
al@20456 95 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
al@20456 96 $fs/etc/nagios/nareto.init.php
al@20456 97 chmod 700 $fs/etc/nagios/nareto.init.php
al@20456 98 ;;
al@20457 99 esac
erjo@8704 100 }
erjo@8704 101
al@20456 102 post_install_nareto() {
pascal@18730 103 [ -s "$1/usr/share/nagios/.htaccess" ] &&
pascal@18730 104 cp "$1/usr/share/nagios/.htaccess" "$1/usr/share/nareto/"
al@20456 105
erjo@8704 106 # Configure lighttpd server
pascal@18730 107 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
pascal@18730 108 if ! grep -q /usr/share/nareto/ "$1/etc/lighttpd/lighttpd.conf"; then
al@20456 109 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 110 if [ -z "$1" ]; then
erjo@8704 111 # Start Web server.
erjo@8704 112 /etc/init.d/lighttpd stop
erjo@8704 113 /etc/init.d/lighttpd start
erjo@8704 114 fi
erjo@8704 115 fi
erjo@8704 116 fi
al@20456 117
erjo@8704 118 # Configure apache server
pascal@18730 119 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 120 sed -i 's/lighttpd/apache/' "$1/etc/rcS.conf"
pascal@18730 121 if [ ! -f "$1/etc/apache/conf.d/nareto" ]; then
pascal@18730 122 cat > "$1/etc/apache/conf.d/nareto" <<EOT
erjo@8704 123 Alias /nareto/ /usr/share/nareto/
erjo@8704 124 <Directory "/usr/share/nareto/">
erjo@8704 125 Options None
erjo@8704 126 AllowOverride AuthConfig
erjo@8704 127 Order allow,deny
erjo@8704 128 Allow from all
erjo@8704 129 </Directory>
erjo@8704 130 EOT
erjo@8704 131 if [ -z "$1" ]; then
erjo@8704 132 # Start Web server.
erjo@8704 133 /etc/init.d/apache stop
erjo@8704 134 /etc/init.d/apache start
erjo@8704 135 fi
erjo@8704 136 fi
erjo@8704 137 fi
erjo@8704 138 }