wok-next rev 14699

Add monitorix
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jun 07 16:22:55 2013 +0200 (2013-06-07)
parents b768ede0c5cb
children c13b8edc9b7d
files monitorix/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/monitorix/receipt	Fri Jun 07 16:22:55 2013 +0200
     1.3 @@ -0,0 +1,73 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="monitorix"
     1.7 +VERSION="3.2.1"
     1.8 +CATEGORY="misc"
     1.9 +SHORT_DESC="A lightweight system monitoring tool."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +LICENSE="GPL2"
    1.12 +WEB_SITE="http://www.monitorix.org/"
    1.13 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.14 +WGET_URL="${WEB_SITE}$TARBALL"
    1.15 +SUGGESTED="iptables logrotate"
    1.16 +
    1.17 +DEPENDS="rrdtool-perl perl-libwww perl-dbi perl-xml-simple perl-cgi \
    1.18 +perl-mailtools perl-mime-lite perl-config-general perl-http-server-simple"
    1.19 +BUILD_DEPENDS=""
    1.20 +
    1.21 +# Rules to configure and make the package.
    1.22 +compile_rules()
    1.23 +{
    1.24 +	cd $src
    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/lib $fs/usr/bin $fs/etc/logrotate.d 
    1.31 +	mkdir -p $fs/usr/share/monitorix
    1.32 +	cp -a $src/monitorix.conf $fs/etc
    1.33 +	sed 's|/var/lib|/usr/lib|' $fs/etc/monitorix.conf
    1.34 +	cp -a $src/docs/monitorix.logrotate $fs/etc/logrotate.d/monitorix
    1.35 +	cp -a $src/monitorix $fs/usr/bin
    1.36 +	cp -a $src/lib $fs/usr/lib/monitorix
    1.37 +	cp -a $src/monitorix.cgi $src/*.png $src/reports $fs/usr/share/monitorix
    1.38 +}
    1.39 +
    1.40 +post_install()
    1.41 +{
    1.42 +	# Configure lighttpd server
    1.43 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.44 +		if ! grep -q /usr/share/monitorix/ $1/etc/lighttpd/lighttpd.conf; then
    1.45 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/monitorix/" => "/usr/share/monitorix/",\n    "/monitorix-cgi/" => "/usr/share/monitorix/cgi/",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.46 +			if [ -z "$1" ]; then
    1.47 +				# Start Web server.
    1.48 +				/etc/init.d/lighttpd stop
    1.49 +				/etc/init.d/lighttpd start
    1.50 +			fi
    1.51 +		fi
    1.52 +	fi
    1.53 +	# Configure apache server
    1.54 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.55 +		if [ ! -f $1/etc/apache/conf.d/monitorix ]; then
    1.56 +			cat > $1/etc/apache/conf.d/monitorix <<EOT
    1.57 +Alias /monitorix /usr/share/monitorix
    1.58 +ScriptAlias /monitorix-cgi /usr/share/monitorix/cgi
    1.59 +
    1.60 +<Directory /usr/share/monitorix/cgi/>
    1.61 +        DirectoryIndex monitorix.cgi
    1.62 +        Options ExecCGI
    1.63 +        Order Deny,Allow
    1.64 +        Deny from all
    1.65 +        Allow from 127.0.0.1
    1.66 +</Directory>
    1.67 +
    1.68 +EOT
    1.69 +			if [ -z "$1" ]; then
    1.70 +				# Start Web server.
    1.71 +				/etc/init.d/apache stop
    1.72 +				/etc/init.d/apache start
    1.73 +			fi
    1.74 +		fi
    1.75 +	fi
    1.76 +}