wok rev 1842

transmission-web: configure lighttpd & apache
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 11 19:45:59 2008 +0000 (2008-12-11)
parents e2718e4cba26
children 8ab0243e5a22
files transmission-web/receipt
line diff
     1.1 --- a/transmission-web/receipt	Thu Dec 11 15:40:01 2008 +0000
     1.2 +++ b/transmission-web/receipt	Thu Dec 11 19:45:59 2008 +0000
     1.3 @@ -5,7 +5,7 @@
     1.4  CATEGORY="network"
     1.5  SHORT_DESC="Transmission web interface."
     1.6  MAINTAINER="pankso@slitaz.org"
     1.7 -DEPENDS="transmission"
     1.8 +DEPENDS="transmission lighttpd"
     1.9  WANTED="transmission"
    1.10  WEB_SITE="http://www.transmissionbt.com/"
    1.11  
    1.12 @@ -16,3 +16,40 @@
    1.13  	cp -a $_pkg/usr/share/transmission $fs/usr/share
    1.14  	rm $fs/usr/share/transmission/web/LICENSE
    1.15  }
    1.16 +
    1.17 +post_install()
    1.18 +{
    1.19 +	# Configure lighttpd server
    1.20 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.21 +		if ! grep -q /usr/share/transmission/web/ $1/etc/lighttpd/lighttpd.conf; then
    1.22 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/transmission/" => "/usr/share/transmission/web/",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.23 +			if [ -z "$1" ]; then
    1.24 +				# Start Web server.
    1.25 +				/etc/init.d/lighttpd stop
    1.26 +				/etc/init.d/lighttpd start
    1.27 +			fi
    1.28 +		fi
    1.29 +	fi
    1.30 +	# Configure apache server
    1.31 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.32 +		if [ ! -f $1/etc/apache/conf.d/transmission ]; then
    1.33 +			cat > $1/etc/apache/conf.d/transmission <<EOT
    1.34 +<IfModule mod_alias.c>
    1.35 +    Alias /transmission /usr/share/transmission/web
    1.36 +</IfModule>
    1.37 +<DirectoryMatch /usr/share/transmission/web>
    1.38 +    DirectoryIndex index.html
    1.39 +    Options +FollowSymLinks
    1.40 +    AllowOverride None
    1.41 +    Order allow,deny
    1.42 +    Allow from all
    1.43 +</DirectoryMatch>
    1.44 +EOT
    1.45 +			if [ -z "$1" ]; then
    1.46 +				# Start Web server.
    1.47 +				/etc/init.d/apache stop
    1.48 +				/etc/init.d/apache start
    1.49 +			fi
    1.50 +		fi
    1.51 +	fi
    1.52 +}