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