wok-next annotate nareto/receipt @ rev 20462
Combine receipts
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Mar 06 03:00:01 2018 +0200 (2018-03-06) |
parents | c3a368c0cddb |
children | b278b2018965 |
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@20456 | 17 SPLIT="nareto-doc" |
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 |
erjo@8704 | 23 } |
erjo@8704 | 24 |
al@20456 | 25 genpkg_rules() { |
al@20456 | 26 case $PACKAGE in |
al@20456 | 27 nareto) |
al@20456 | 28 mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/etc/initcron.d $fs/etc/nagios |
al@20456 | 29 |
al@20456 | 30 cp -a $src $fs/usr/share/nareto |
al@20456 | 31 cp -a stuff/* $fs |
al@20456 | 32 sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php |
al@20456 | 33 sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \ |
al@20456 | 34 $fs/usr/share/nareto/index.php \ |
al@20456 | 35 $fs/usr/share/nareto/administration/gestion_auto.php |
al@20456 | 36 find $fs/usr/share/nareto -type f \ |
al@20456 | 37 | while read file; do |
al@20456 | 38 case "$file" in |
al@20456 | 39 *.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;; |
al@20456 | 40 esac |
al@20456 | 41 dos2unix "$file" |
al@20456 | 42 sed -i 's/<?/<?php /g' "$file" |
al@20456 | 43 sed -i 's/<?php xml/<?xml/g' "$file" |
al@20456 | 44 sed -i 's/<?php php/<?php/g' "$file" |
al@20456 | 45 sed -i 's/<?php =/<?php echo /g' "$file" |
al@20456 | 46 done |
al@20456 | 47 mv $fs/usr/share/nareto/include/config.ini.php \ |
al@20456 | 48 $fs/etc/nagios/nareto.init.php |
al@20456 | 49 ln -s /etc/nagios/nareto.init.php \ |
al@20456 | 50 $fs/usr/share/nareto/include/config.ini.php |
al@20456 | 51 sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \ |
al@20456 | 52 $fs/etc/nagios/nareto.init.php |
al@20456 | 53 chmod 700 $fs/etc/nagios/nareto.init.php |
al@20456 | 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 |
al@20456 | 69 chmod +x $fs/etc/mysql.d/nareto |
al@20456 | 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 |
al@20456 | 81 chmod +x $fs/etc/initcron.d/nareto |
al@20456 | 82 |
al@20456 | 83 # Move doc in nareto-doc package. |
al@20456 | 84 rm -rf $fs/usr/share/nareto/docs |
al@20456 | 85 ;; |
al@20456 | 86 nareto-doc) |
al@20456 | 87 mkdir -p $fs/usr/share/nareto |
al@20456 | 88 cp -a $src/docs $fs/usr/share/nareto |
al@20456 | 89 CAT="network|documentation" |
al@20456 | 90 DEPENDS="nareto" |
al@20456 | 91 ;; |
al@20457 | 92 esac |
erjo@8704 | 93 } |
erjo@8704 | 94 |
al@20456 | 95 post_install_nareto() { |
pascal@18730 | 96 [ -s "$1/usr/share/nagios/.htaccess" ] && |
pascal@18730 | 97 cp "$1/usr/share/nagios/.htaccess" "$1/usr/share/nareto/" |
al@20456 | 98 |
erjo@8704 | 99 # Configure lighttpd server |
pascal@18730 | 100 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then |
pascal@18730 | 101 if ! grep -q /usr/share/nareto/ "$1/etc/lighttpd/lighttpd.conf"; then |
al@20456 | 102 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 | 103 if [ -z "$1" ]; then |
erjo@8704 | 104 # Start Web server. |
erjo@8704 | 105 /etc/init.d/lighttpd stop |
erjo@8704 | 106 /etc/init.d/lighttpd start |
erjo@8704 | 107 fi |
erjo@8704 | 108 fi |
erjo@8704 | 109 fi |
al@20456 | 110 |
erjo@8704 | 111 # Configure apache server |
pascal@18730 | 112 if [ -f "$1/etc/apache/httpd.conf" ]; then |
pascal@18730 | 113 sed -i 's/lighttpd/apache/' "$1/etc/rcS.conf" |
pascal@18730 | 114 if [ ! -f "$1/etc/apache/conf.d/nareto" ]; then |
pascal@18730 | 115 cat > "$1/etc/apache/conf.d/nareto" <<EOT |
erjo@8704 | 116 Alias /nareto/ /usr/share/nareto/ |
erjo@8704 | 117 <Directory "/usr/share/nareto/"> |
erjo@8704 | 118 Options None |
erjo@8704 | 119 AllowOverride AuthConfig |
erjo@8704 | 120 Order allow,deny |
erjo@8704 | 121 Allow from all |
erjo@8704 | 122 </Directory> |
erjo@8704 | 123 EOT |
erjo@8704 | 124 if [ -z "$1" ]; then |
erjo@8704 | 125 # Start Web server. |
erjo@8704 | 126 /etc/init.d/apache stop |
erjo@8704 | 127 /etc/init.d/apache start |
erjo@8704 | 128 fi |
erjo@8704 | 129 fi |
erjo@8704 | 130 fi |
erjo@8704 | 131 } |