wok diff ajaxterm/receipt @ rev 1951

Add ajaxterm
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 29 14:27:07 2008 +0000 (2008-12-29)
parents
children a18388f52400
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ajaxterm/receipt	Mon Dec 29 14:27:07 2008 +0000
     1.3 @@ -0,0 +1,101 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="ajaxterm"
     1.7 +VERSION="0.10"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Login terminal for the web."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +SOURCE="Ajaxterm"
    1.12 +TARBALL="$SOURCE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://antony.lesuisse.org/qweb/trac/wiki/AjaxTerm"
    1.14 +WGET_URL="http://antony.lesuisse.org/qweb/files/$TARBALL"
    1.15 +DEPENDS="python"
    1.16 +SUGGESTED="apache lighttpd-ssl lighttpd-modules"
    1.17 +
    1.18 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.19 +genpkg_rules()
    1.20 +{
    1.21 +	mkdir -p $fs/usr/share/ajaxterm
    1.22 +	cp -a $src/*.py $src/*.js $src/*.css $src/*.html $fs/usr/share/ajaxterm
    1.23 +	cp -a stuff/* $fs/
    1.24 +}
    1.25 +
    1.26 +post_install()
    1.27 +{
    1.28 +	grep ^RUN_DAEMONS $1/etc/rcS.conf | grep -q "ajaxterm" || sed -i \
    1.29 +	  's/RUN_DAEMONS="slim/RUN_DAEMONS="slim ajaxterm/' $1/etc/rcS.conf
    1.30 +	# Configure lighttpd server
    1.31 +	if [ -f $1/usr/lib/lighttpd/mod_proxy.so ]; then
    1.32 +#https://www.dupnet.org/dotclear/index.php/2007/10/07/11-ajaxterm-et-lighttpd
    1.33 +#http://www.lighttpd.net
    1.34 +			grep -q mod_proxy $1/etc/lighttpd/lighttpd.conf ||
    1.35 +			cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
    1.36 +server.modules += ( "mod_proxy" )
    1.37 +EOT
    1.38 +			grep -q ajaxterm $1/etc/lighttpd/lighttpd.conf ||
    1.39 +			cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
    1.40 +proxy.server = ( "/ajaxterm/" =>
    1.41 +	( ( "host" => "127.0.0.1", "port" => 8022 ) )
    1.42 +)
    1.43 +EOT
    1.44 +			grep -q mod_redirect $1/etc/lighttpd/lighttpd.conf ||
    1.45 +			cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
    1.46 +server.modules += ( "mod_redirect" )
    1.47 +EOT
    1.48 +			grep -q https:// $1/etc/lighttpd/lighttpd.conf &&
    1.49 +			cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
    1.50 +\$SERVER["socket"] == ":80" {
    1.51 +	\$HTTP["host"] =~ "(.*)" {
    1.52 +		url.redirect = ( "^/ajaxterm" => "https://%1/ajaxterm/" )
    1.53 +	}
    1.54 +}
    1.55 +EOT
    1.56 +			if [ -z "$1" ]; then
    1.57 +				# Start Web server.
    1.58 +				/etc/init.d/lighttpd stop
    1.59 +				/etc/init.d/lighttpd start
    1.60 +			fi
    1.61 +	fi
    1.62 +	# Configure apache server
    1.63 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.64 +#http://smhteam.info/wiki/index.linux.php5?wiki=AjaxTerm
    1.65 +		if [ ! -f $1/etc/apache/conf.d/ajaxterm ]; then
    1.66 +			cat > $1/etc/apache/conf.d/ajaxterm <<EOT
    1.67 +<IfModule mod_proxy.c>
    1.68 +    ProxyRequests Off
    1.69 +    <Proxy *>
    1.70 +            Order deny,allow
    1.71 +            Allow from all
    1.72 +    </Proxy>
    1.73 +    ProxyPass /ajaxterm/ http://localhost:8022/
    1.74 +    ProxyPassReverse /ajaxterm/ http://localhost:8022/
    1.75 +</IfModule>
    1.76 +
    1.77 +<IfModule mod_rewrite.c>
    1.78 +     RewriteEngine On
    1.79 +     RewriteCond %{SERVER_PORT}      !^443$
    1.80 +     RewriteRule ^/ajaxterm      https://%{SERVER_NAME}/ajaxterm/ [L,R=303]
    1.81 +</IfModule>
    1.82 +EOT
    1.83 +			if [ -z "$1" ]; then
    1.84 +				# Start Web server.
    1.85 +				/etc/init.d/apache stop
    1.86 +				sleep 2
    1.87 +				/etc/init.d/apache start
    1.88 +			fi
    1.89 +		fi
    1.90 +	fi
    1.91 +	[ -z "$1" ] && /etc/init.d/ajaxterm start
    1.92 +	[ ! -f $1/usr/lib/lighttpd/mod_proxy.so -a \
    1.93 +	  ! -f $1/etc/apache/httpd.conf ] && cat <<EOT
    1.94 +--------
    1.95 +You should install either lighttpd
    1.96 +# tazpkg get-install lighttpd-ssl ; tazpkg get-install lighttpd-modules
    1.97 +or apache
    1.98 +# tazpkg get-install apache
    1.99 +and reconfigure
   1.100 +# tazpkg reconfigure ajaxterm
   1.101 +--------
   1.102 +EOT
   1.103 +}
   1.104 +