wok annotate nareto/receipt @ rev 17632

lensfun: buggy make version check workaround
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 14 13:45:08 2015 +0100 (2015-02-14)
parents 2b32764afdc5
children 9e01bc6321ea
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 {
erjo@8704 89 [ -s $1/usr/share/nagios/.htaccess ] &&
erjo@8704 90 cp $1/usr/share/nagios/.htaccess $1/usr/share/nareto/
erjo@8704 91 # Configure lighttpd server
erjo@8704 92 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
erjo@8704 93 if ! grep -q /usr/share/nareto/ $1/etc/lighttpd/lighttpd.conf; then
erjo@8704 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
erjo@8704 104 if [ -f $1/etc/apache/httpd.conf ]; then
erjo@8704 105 sed -i 's/lighttpd/apache/' $1/etc/rcS.conf
erjo@8704 106 if [ ! -f $1/etc/apache/conf.d/nareto ]; then
erjo@8704 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