wok-6.x view ajaxterm/receipt @ rev 3617
ajaxterm: fix apache rewrite rule
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jun 30 15:57:04 2009 +0200 (2009-06-30) |
parents | 2bbc0ef3f1d2 |
children | 84b5d08255f2 |
line source
1 # SliTaz package receipt.
3 PACKAGE="ajaxterm"
4 VERSION="0.10"
5 CATEGORY="network"
6 SHORT_DESC="Login terminal for the web."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 SOURCE="Ajaxterm"
9 TARBALL="$SOURCE-$VERSION.tar.gz"
10 WEB_SITE="http://antony.lesuisse.org/software/$PACKAGE/"
11 WGET_URL="${WEB_SITE}files/$TARBALL"
12 DEPENDS="python"
13 SUGGESTED="apache lighttpd-ssl lighttpd-modules"
14 TAGS="web application"
16 # Rules to gen a SliTaz package suitable for Tazpkg.
17 genpkg_rules()
18 {
19 mkdir -p $fs/usr/share/ajaxterm
20 cp -a $src/*.py $src/*.js $src/*.css $src/*.html $fs/usr/share/ajaxterm
21 cp -a stuff/* $fs/
22 }
24 post_install()
25 {
26 grep ^RUN_DAEMONS $1/etc/rcS.conf | grep -q "ajaxterm" || sed -i \
27 's/RUN_DAEMONS="/RUN_DAEMONS="ajaxterm /' $1/etc/rcS.conf
28 # Configure lighttpd server
29 if [ -f $1/usr/lib/lighttpd/mod_proxy.so ]; then
30 #https://www.dupnet.org/dotclear/index.php/2007/10/07/11-ajaxterm-et-lighttpd
31 #http://www.lighttpd.net
32 grep -q mod_proxy $1/etc/lighttpd/lighttpd.conf ||
33 cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
34 server.modules += ( "mod_proxy" )
35 EOT
36 grep -q ajaxterm $1/etc/lighttpd/lighttpd.conf ||
37 cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
38 proxy.server = ( "/ajaxterm/" =>
39 ( ( "host" => "127.0.0.1", "port" => 8022 ) )
40 )
41 EOT
42 grep -q mod_redirect $1/etc/lighttpd/lighttpd.conf ||
43 cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
44 server.modules += ( "mod_redirect" )
45 EOT
46 grep -q https:// $1/etc/lighttpd/lighttpd.conf &&
47 cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
48 \$SERVER["socket"] == ":80" {
49 \$HTTP["host"] =~ "(.*)" {
50 url.redirect = ( "^/ajaxterm" => "https://%1/ajaxterm/" )
51 }
52 }
53 EOT
54 if [ -z "$1" ]; then
55 # Start Web server.
56 /etc/init.d/lighttpd stop
57 /etc/init.d/lighttpd start
58 fi
59 fi
60 # Configure apache server
61 if [ -f $1/etc/apache/httpd.conf ]; then
62 #http://smhteam.info/wiki/index.linux.php5?wiki=AjaxTerm
63 if [ ! -f $1/etc/apache/conf.d/ajaxterm ]; then
64 cat > $1/etc/apache/conf.d/ajaxterm <<EOT
65 <IfModule mod_proxy.c>
66 ProxyRequests Off
67 <Proxy *>
68 Order deny,allow
69 Allow from all
70 </Proxy>
71 ProxyPass /ajaxterm/ http://localhost:8022/
72 ProxyPassReverse /ajaxterm/ http://localhost:8022/
73 </IfModule>
75 <LocationMatch ^/ajaxterm>
76 <IfModule mod_rewrite.c>
77 RewriteEngine On
78 RewriteCond %{HTTPS} off
79 RewriteRule ^.*$ https://%{SERVER_NAME}/ajaxterm/ [L,R=303]
80 </IfModule>
81 </LocationMatch>
82 EOT
83 if [ -z "$1" ]; then
84 # Start Web server.
85 /etc/init.d/apache stop
86 sleep 2
87 /etc/init.d/apache start
88 fi
89 fi
90 fi
91 [ -z "$1" ] && /etc/init.d/ajaxterm start
92 [ ! -f $1/usr/lib/lighttpd/mod_proxy.so -a \
93 ! -f $1/etc/apache/httpd.conf ] && cat <<EOT
94 --------
95 You should install either lighttpd
96 # tazpkg get-install lighttpd-ssl ; tazpkg get-install lighttpd-modules
97 or apache
98 # tazpkg get-install apache
99 and reconfigure
100 # tazpkg reconfigure ajaxterm
101 --------
102 EOT
103 }