wok-next diff nareto/receipt @ rev 12645

mousepad: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 29 23:12:11 2012 +0200 (2012-04-29)
parents
children 3765f181a6d5
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nareto/receipt	Sun Apr 29 23:12:11 2012 +0200
     1.3 @@ -0,0 +1,122 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="nareto"
     1.7 +VERSION="1.1.6"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Nagios reporting tool."
    1.10 +MAINTAINER="erjo@slitaz.org"
    1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.12 +WEB_SITE="http://www.nareto.org/"
    1.13 +WGET_URL="${WEB_SITE}srcs/$TARBALL"
    1.14 +DEPENDS="nagios apache php php-cli mysql perl-dbd-mysql perl-dbi"
    1.15 +CONFIG_FILES="/etc/nagios"
    1.16 +BUGS="s/oreon/centreon/"
    1.17 +
    1.18 +# Rules to configure and make the package.
    1.19 +compile_rules()
    1.20 +{
    1.21 +	cd $src
    1.22 +	chown -R www.www *
    1.23 +	chmod -R 755 *
    1.24 +	chmod u+x scripts/*.pl
    1.25 +}
    1.26 +
    1.27 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.28 +genpkg_rules()
    1.29 +{
    1.30 +	mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/etc/initcron.d $fs/etc/nagios
    1.31 +	
    1.32 +	cp -a $src $fs/usr/share/nareto
    1.33 +	cp -a stuff/* $fs
    1.34 +	sed -i 's/oreon.jpg/centreon.png/' $fs/usr/share/nareto/index.php
    1.35 +	sed -i -e 's/oreon/centreon/g' -e 's/Oreon/Centreon/g' \
    1.36 +		 $fs/usr/share/nareto/index.php \
    1.37 +		 $fs/usr/share/nareto/administration/gestion_auto.php
    1.38 +	find $fs/usr/share/nareto -type f | while read file; do
    1.39 +		case "$file" in
    1.40 +		*.jpg|*.png|*.gif|*.pdf|*.ttf|*.xls|*.html) continue;;
    1.41 +		esac
    1.42 +		dos2unix "$file"
    1.43 +		sed -i 's/<?/<?php /g' "$file"
    1.44 +		sed -i 's/<?php xml/<?xml/g' "$file"
    1.45 +		sed -i 's/<?php php/<?php/g' "$file"
    1.46 +		sed -i 's/<?php =/<?php echo /g' "$file"
    1.47 +	done
    1.48 +	mv $fs/usr/share/nareto/include/config.ini.php \
    1.49 +		 $fs/etc/nagios/nareto.init.php
    1.50 +	ln -s /etc/nagios/nareto.init.php \
    1.51 +		$fs/usr/share/nareto/include/config.ini.php
    1.52 +	sed -i -e 's/user$/nareto/' -e 's/password$/nareto/' \
    1.53 +		 $fs/etc/nagios/nareto.init.php
    1.54 +	chmod 700 $fs/etc/nagios/nareto.init.php
    1.55 +	cat > $fs/etc/mysql.d/nareto <<EOM
    1.56 +#!/bin/sh
    1.57 +
    1.58 +mysqldump nareto > /dev/null 2>&1 || mysql <<EOT
    1.59 +create database nareto;
    1.60 +use nareto;
    1.61 +
    1.62 +\. /usr/share/nareto/scripts/nareto.sql
    1.63 +
    1.64 +GRANT USAGE ON nareto.* TO 'nareto'@'localhost' IDENTIFIED BY 'nareto';
    1.65 +FLUSH PRIVILEGES;
    1.66 +
    1.67 +EOT
    1.68 +chmod -x /etc/mysql.d/nareto
    1.69 +EOM
    1.70 +	chmod +x $fs/etc/mysql.d/nareto
    1.71 +	cat > $fs/etc/initcron.d/nareto <<EOT
    1.72 +# Reporting
    1.73 +#FIXME LEAK?#*/5 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_5min.php > /dev/null 2>&1
    1.74 +#FIXME LEAK?#2 * * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1h.php > /dev/null 2>&1
    1.75 +#FIXME LEAK?#4 14 * * * root /usr/bin/php /usr/share/nareto/scripts/nareto_dispo_cron_1jour.php > /dev/null 2>&1
    1.76 +
    1.77 +# Suivi des alarmes
    1.78 +#FIXME LEAK?#30 0 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert.pl > /dev/null 2>&1
    1.79 +#FIXME LEAK?#0 1 * * * root /usr/bin/perl /usr/share/nareto/scripts/nagios_alert_agregation.pl > /dev/null 2>&1
    1.80 +
    1.81 +EOT
    1.82 +	chmod +x $fs/etc/initcron.d/nareto
    1.83 +	
    1.84 +	# Move doc in nareto-doc package.
    1.85 +	rm -rf $fs/usr/share/nareto/docs
    1.86 +}
    1.87 +
    1.88 +post_install()
    1.89 +{
    1.90 +	[ -s $1/usr/share/nagios/.htaccess ] &&
    1.91 +	cp $1/usr/share/nagios/.htaccess $1/usr/share/nareto/
    1.92 +	# Configure lighttpd server
    1.93 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.94 +		if ! grep -q /usr/share/nareto/ $1/etc/lighttpd/lighttpd.conf; then
    1.95 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/nareto/" => "/usr/share/nareto",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.96 +			if [ -z "$1" ]; then
    1.97 +				# Start Web server.
    1.98 +				/etc/init.d/lighttpd stop
    1.99 +				/etc/init.d/lighttpd start
   1.100 +			fi
   1.101 +		fi
   1.102 +	fi
   1.103 +	
   1.104 +	# Configure apache server
   1.105 +	if [ -f $1/etc/apache/httpd.conf ]; then
   1.106 +		sed -i 's/lighttpd/apache/' $1/etc/rcS.conf
   1.107 +		if [ ! -f $1/etc/apache/conf.d/nareto ]; then
   1.108 +			cat > $1/etc/apache/conf.d/nareto <<EOT
   1.109 +Alias /nareto/ /usr/share/nareto/
   1.110 +<Directory "/usr/share/nareto/">
   1.111 +Options None
   1.112 +AllowOverride AuthConfig
   1.113 +Order allow,deny
   1.114 +Allow from all
   1.115 +</Directory>
   1.116 +EOT
   1.117 +			if [ -z "$1" ]; then
   1.118 +				# Start Web server.
   1.119 +				/etc/init.d/apache stop
   1.120 +				/etc/init.d/apache start
   1.121 +			fi
   1.122 +		fi
   1.123 +	fi
   1.124 +}
   1.125 +