wok view ajaxterm/receipt @ rev 3581

merge
author Liu Peng <rocky@slitaz.org>
date Fri Jun 26 14:31:03 2009 +0000 (2009-06-26)
parents a88940f8334a
children 94863a7d1610
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 <IfModule mod_rewrite.c>
76 RewriteEngine On
77 RewriteCond %{SERVER_PORT} !^443$
78 RewriteRule ^/ajaxterm https://%{SERVER_NAME}/ajaxterm/ [L,R=303]
79 </IfModule>
80 EOT
81 if [ -z "$1" ]; then
82 # Start Web server.
83 /etc/init.d/apache stop
84 sleep 2
85 /etc/init.d/apache start
86 fi
87 fi
88 fi
89 [ -z "$1" ] && /etc/init.d/ajaxterm start
90 [ ! -f $1/usr/lib/lighttpd/mod_proxy.so -a \
91 ! -f $1/etc/apache/httpd.conf ] && cat <<EOT
92 --------
93 You should install either lighttpd
94 # tazpkg get-install lighttpd-ssl ; tazpkg get-install lighttpd-modules
95 or apache
96 # tazpkg get-install apache
97 and reconfigure
98 # tazpkg reconfigure ajaxterm
99 --------
100 EOT
101 }