wok-current rev 1951

Add ajaxterm
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 29 14:27:07 2008 +0000 (2008-12-29)
parents 5117bf553562
children a18388f52400
files ajaxterm/receipt ajaxterm/stuff/etc/init.d/ajaxterm ajaxterm/stuff/usr/share/ajaxterm/ajaxterm.js ajaxterm/stuff/usr/share/ajaxterm/login
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 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ajaxterm/stuff/etc/init.d/ajaxterm	Mon Dec 29 14:27:07 2008 +0000
     2.3 @@ -0,0 +1,62 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/ajaxterm : Start, stop and restart AjaxTerm server on SliTaz, at 
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start AjaxTerm server at boot time, just put ajaxterm in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=AjaxTerm
    2.15 +DESC="AjaxTerm server"
    2.16 +DAEMON="/usr/share/ajaxterm/ajaxterm.py"
    2.17 +OPTIONS=$AJAXTERM_OPTIONS
    2.18 +PIDFILE=/var/run/ajaxterm.pid
    2.19 +[ -n "$OPTIONS" ] || OPTIONS="--pidfile $PIDFILE --daemon --port=8022 --command=/usr/share/ajaxterm/login"
    2.20 +export PYTHONPATH=/usr/share/ajaxterm
    2.21 +
    2.22 +case "$1" in
    2.23 +  start)
    2.24 +    if [ -f $PIDFILE ] ; then
    2.25 +      echo "$NAME already running."
    2.26 +      exit 1
    2.27 +    fi
    2.28 +    echo -n "Starting $DESC: $NAME... "
    2.29 +    $DAEMON $OPTIONS
    2.30 +    status
    2.31 +    sleep 2
    2.32 +    ;;
    2.33 +  stop)
    2.34 +    if [ ! -f $PIDFILE ] ; then
    2.35 +      echo "$NAME is not running."
    2.36 +      exit 1
    2.37 +    fi
    2.38 +    echo -n "Stopping $DESC: $NAME... "
    2.39 +    kill `cat $PIDFILE`
    2.40 +    status
    2.41 +    rm -f $PIDFILE
    2.42 +    sleep 2
    2.43 +    ;;
    2.44 +  restart)
    2.45 +    if [ ! -f $PIDFILE ] ; then
    2.46 +      echo "$NAME is not running."
    2.47 +      exit 1
    2.48 +    fi
    2.49 +    echo -n "Restarting $DESC: $NAME... "
    2.50 +    kill `cat $PIDFILE`
    2.51 +    rm -f $PIDFILE
    2.52 +    sleep 2
    2.53 +    $DAEMON $OPTIONS
    2.54 +    status
    2.55 +    sleep 2
    2.56 +    ;;
    2.57 +  *)
    2.58 +    echo ""
    2.59 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.60 +    echo ""
    2.61 +    exit 1
    2.62 +    ;;
    2.63 +esac
    2.64 +
    2.65 +exit 0
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ajaxterm/stuff/usr/share/ajaxterm/ajaxterm.js	Mon Dec 29 14:27:07 2008 +0000
     3.3 @@ -0,0 +1,302 @@
     3.4 +ajaxterm={};
     3.5 +ajaxterm.Terminal_ctor=function(id,width,height) {
     3.6 +	var ie=0;
     3.7 +	if(window.ActiveXObject)
     3.8 +		ie=1;
     3.9 +	var sid=""+Math.round(Math.random()*1000000000);
    3.10 +	var query0="s="+sid+"&w="+width+"&h="+height;
    3.11 +	var query1=query0+"&c=1&k=";
    3.12 +	var buf="";
    3.13 +	var timeout;
    3.14 +	var error_timeout;
    3.15 +	var keybuf=[];
    3.16 +	var sending=0;
    3.17 +	var rmax=1;
    3.18 +	var popupargs='width='+(25+(width*7))+
    3.19 +			',height='+(45+(height*14))+',scrollbars=no';
    3.20 +	var debugmsg=0;
    3.21 +
    3.22 +	var div=document.getElementById(id);
    3.23 +	var dstat=document.createElement('pre');
    3.24 +	var sled=document.createElement('span');
    3.25 +	var opt_get=document.createElement('a');
    3.26 +	var opt_color=document.createElement('a');
    3.27 +	var opt_paste=document.createElement('a');
    3.28 +	var opt_popup=document.createElement('a');
    3.29 +	var opt_close=document.createElement('a');
    3.30 +	var sdebug=document.createElement('span');
    3.31 +	var dterm=document.createElement('div');
    3.32 +
    3.33 +	function debug(s) {
    3.34 +		debugmsg=1;
    3.35 +		sdebug.innerHTML=s;
    3.36 +	}
    3.37 +	function error() {
    3.38 +		sled.className='off';
    3.39 +//		debug("Connection lost timeout ts:"+((new Date).getTime()));
    3.40 +		debug("Connection lost "+((new Date).toTimeString()));
    3.41 +	}
    3.42 +	function opt_add(opt,name) {
    3.43 +		opt.className='off';
    3.44 +		opt.innerHTML=' '+name+' ';
    3.45 +		dstat.appendChild(opt);
    3.46 +		dstat.appendChild(document.createTextNode(' '));
    3.47 +	}
    3.48 +	function do_get(event) {
    3.49 +		opt_get.className=(opt_get.className=='off')?'on':'off';
    3.50 +		debug('GET '+opt_get.className);
    3.51 +	}
    3.52 +	function do_color(event) {
    3.53 +		var o=opt_color.className=(opt_color.className=='off')?'on':'off';
    3.54 +		if(o=='on')
    3.55 +			query1=query0+"&c=1&k=";
    3.56 +		else
    3.57 +			query1=query0+"&k=";
    3.58 +		debug('Color '+opt_color.className);
    3.59 +	}
    3.60 +	function mozilla_clipboard() {
    3.61 +		 // mozilla sucks
    3.62 +		try {
    3.63 +			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    3.64 +		} catch (err) {
    3.65 +			debug('Access denied, <a href="http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard" target="_blank">more info</a>');
    3.66 +			return undefined;
    3.67 +		}
    3.68 +		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
    3.69 +		var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    3.70 +		if (!clip || !trans) {
    3.71 +			return undefined;
    3.72 +		}
    3.73 +		trans.addDataFlavor("text/unicode");
    3.74 +		clip.getData(trans,clip.kGlobalClipboard);
    3.75 +		var str=new Object();
    3.76 +		var strLength=new Object();
    3.77 +		try {
    3.78 +			trans.getTransferData("text/unicode",str,strLength);
    3.79 +		} catch(err) {
    3.80 +			return "";
    3.81 +		}
    3.82 +		if (str) {
    3.83 +			str=str.value.QueryInterface(Components.interfaces.nsISupportsString);
    3.84 +		}
    3.85 +		if (str) {
    3.86 +			return str.data.substring(0,strLength.value / 2);
    3.87 +		} else {
    3.88 +			return "";
    3.89 +		}
    3.90 +	}
    3.91 +	function do_paste(event) {
    3.92 +		var p=undefined;
    3.93 +		if (window.clipboardData) {
    3.94 +			p=window.clipboardData.getData("Text");
    3.95 +		} else if(window.netscape) {
    3.96 +			p=mozilla_clipboard();
    3.97 +		}
    3.98 +		if (p) {
    3.99 +			debug('Pasted');
   3.100 +			queue(encodeURIComponent(p));
   3.101 +		} else {
   3.102 +		}
   3.103 +	}
   3.104 +	function do_popup(event) {
   3.105 +		window.open(''+self.location,'',popupargs);
   3.106 +	}
   3.107 +	function do_close(event) {
   3.108 +		window.close();
   3.109 +	}
   3.110 +	function update() {
   3.111 +//		debug("ts: "+((new Date).getTime())+" rmax:"+rmax);
   3.112 +		if(debugmsg==0) sdebug.innerHTML=(new Date).toString();
   3.113 +		if(sending==0) {
   3.114 +			sending=1;
   3.115 +			sled.className='on';
   3.116 +			var r=new XMLHttpRequest();
   3.117 +			var send="";
   3.118 +			while(keybuf.length>0) {
   3.119 +				send+=keybuf.pop();
   3.120 +			}
   3.121 +			var query=query1+send;
   3.122 +			if(opt_get.className=='on') {
   3.123 +				r.open("GET","u?"+query,true);
   3.124 +				if(ie) {
   3.125 +					r.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
   3.126 +				}
   3.127 +			} else {
   3.128 +				r.open("POST","u",true);
   3.129 +			}
   3.130 +			r.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   3.131 +			r.onreadystatechange = function () {
   3.132 +//				debug("xhr:"+((new Date).getTime())+" state:"+r.readyState+" status:"+r.status+" statusText:"+r.statusText);
   3.133 +				if (r.readyState==4) {
   3.134 +					if(r.status==200) {
   3.135 +						window.clearTimeout(error_timeout);
   3.136 +						de=r.responseXML.documentElement;
   3.137 +						if(de.tagName=="pre") {
   3.138 +							if(ie) {
   3.139 +								Sarissa.updateContentFromNode(de, dterm);
   3.140 +							} else {
   3.141 +								Sarissa.updateContentFromNode(de, dterm);
   3.142 +//								old=div.firstChild;
   3.143 +//								div.replaceChild(de,old);
   3.144 +							}
   3.145 +							rmax=100;
   3.146 +						} else {
   3.147 +							rmax*=2;
   3.148 +							if(rmax>2000)
   3.149 +								rmax=2000;
   3.150 +						}
   3.151 +						sending=0;
   3.152 +						sled.className='off';
   3.153 +						timeout=window.setTimeout(update,rmax);
   3.154 +					} else {
   3.155 +						debug("Connection error status:"+r.status);
   3.156 +					}
   3.157 +				}
   3.158 +			}
   3.159 +			error_timeout=window.setTimeout(error,5000);
   3.160 +			if(opt_get.className=='on') {
   3.161 +				r.send(null);
   3.162 +			} else {
   3.163 +				r.send(query);
   3.164 +			}
   3.165 +		}
   3.166 +	}
   3.167 +	function queue(s) {
   3.168 +		keybuf.unshift(s);
   3.169 +		if(sending==0) {
   3.170 +			window.clearTimeout(timeout);
   3.171 +			timeout=window.setTimeout(update,1);
   3.172 +		}
   3.173 +	}
   3.174 +	function keypress(ev) {
   3.175 +		if (!ev) var ev=window.event;
   3.176 +//		s="kp keyCode="+ev.keyCode+" which="+ev.which+" shiftKey="+ev.shiftKey+" ctrlKey="+ev.ctrlKey+" altKey="+ev.altKey;
   3.177 +//		debug(s);
   3.178 +//		return false;
   3.179 +//		else { if (!ev.ctrlKey || ev.keyCode==17) { return; }
   3.180 +		var kc;
   3.181 +		var k="";
   3.182 +		if (ev.keyCode)
   3.183 +			kc=ev.keyCode;
   3.184 +		if (ev.which)
   3.185 +			kc=ev.which;
   3.186 +		if (ev.altKey) {
   3.187 +			if (kc>=65 && kc<=90)
   3.188 +				kc+=32;
   3.189 +			if (kc>=97 && kc<=122) {
   3.190 +				k=String.fromCharCode(27)+String.fromCharCode(kc);
   3.191 +			}
   3.192 +		} else if (ev.ctrlKey) {
   3.193 +			if (kc>=65 && kc<=90) k=String.fromCharCode(kc-64); // Ctrl-A..Z
   3.194 +			else if (kc>=97 && kc<=122) k=String.fromCharCode(kc-96); // Ctrl-A..Z
   3.195 +			else if (kc==54)  k=String.fromCharCode(30); // Ctrl-^
   3.196 +			else if (kc==109) k=String.fromCharCode(31); // Ctrl-_
   3.197 +			else if (kc==219) k=String.fromCharCode(27); // Ctrl-[
   3.198 +			else if (kc==220) k=String.fromCharCode(28); // Ctrl-\
   3.199 +			else if (kc==221) k=String.fromCharCode(29); // Ctrl-]
   3.200 +			else if (kc==219) k=String.fromCharCode(29); // Ctrl-]
   3.201 +			else if (kc==219) k=String.fromCharCode(0);  // Ctrl-@
   3.202 +		} else if (ev.which==0) {
   3.203 +			if (kc==9) k=String.fromCharCode(9);  // Tab
   3.204 +			else if (kc==8) k=String.fromCharCode(127);  // Backspace
   3.205 +			else if (kc==27) k=String.fromCharCode(27); // Escape
   3.206 +			else {
   3.207 +				if (kc==33) k="[5~";        // PgUp
   3.208 +				else if (kc==34) k="[6~";   // PgDn
   3.209 +				else if (kc==35) k="[4~";   // End
   3.210 +				else if (kc==36) k="[1~";   // Home
   3.211 +				else if (kc==37) k="[D";    // Left
   3.212 +				else if (kc==38) k="[A";    // Up
   3.213 +				else if (kc==39) k="[C";    // Right
   3.214 +				else if (kc==40) k="[B";    // Down
   3.215 +				else if (kc==45) k="[2~";   // Ins
   3.216 +				else if (kc==46) k="[3~";   // Del
   3.217 +				else if (kc==112) k="[[A";  // F1
   3.218 +				else if (kc==113) k="[[B";  // F2
   3.219 +				else if (kc==114) k="[[C";  // F3
   3.220 +				else if (kc==115) k="[[D";  // F4
   3.221 +				else if (kc==116) k="[[E";  // F5
   3.222 +				else if (kc==117) k="[17~"; // F6
   3.223 +				else if (kc==118) k="[18~"; // F7
   3.224 +				else if (kc==119) k="[19~"; // F8
   3.225 +				else if (kc==120) k="[20~"; // F9
   3.226 +				else if (kc==121) k="[21~"; // F10
   3.227 +				else if (kc==122) k="[23~"; // F11
   3.228 +				else if (kc==123) k="[24~"; // F12
   3.229 +				if (k.length) {
   3.230 +					k=String.fromCharCode(27)+k;
   3.231 +				}
   3.232 +			}
   3.233 +		} else {
   3.234 +			if (kc==8)
   3.235 +				k=String.fromCharCode(127);  // Backspace
   3.236 +			else
   3.237 +				k=String.fromCharCode(kc);
   3.238 +		}
   3.239 +		if(k.length) {
   3.240 +//			queue(encodeURIComponent(k));
   3.241 +			if(k=="+") {
   3.242 +				queue("%2B");
   3.243 +			} else {
   3.244 +				queue(escape(k));
   3.245 +			}
   3.246 +		}
   3.247 +		ev.cancelBubble=true;
   3.248 +		if (ev.stopPropagation) ev.stopPropagation();
   3.249 +		if (ev.preventDefault)  ev.preventDefault();
   3.250 +		return false;
   3.251 +	}
   3.252 +	function keydown(ev) {
   3.253 +		if (!ev) var ev=window.event;
   3.254 +		if (ie) {
   3.255 +//			s="kd keyCode="+ev.keyCode+" which="+ev.which+" shiftKey="+ev.shiftKey+" ctrlKey="+ev.ctrlKey+" altKey="+ev.altKey;
   3.256 +//			debug(s);
   3.257 +			o={9:1,8:1,27:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,45:1,46:1,112:1,
   3.258 +			113:1,114:1,115:1,116:1,117:1,118:1,119:1,120:1,121:1,122:1,123:1};
   3.259 +			if (o[ev.keyCode] || ev.ctrlKey || ev.altKey) {
   3.260 +				ev.which=0;
   3.261 +				return keypress(ev);
   3.262 +			}
   3.263 +		}
   3.264 +	}
   3.265 +	function init() {
   3.266 +		sled.appendChild(document.createTextNode('\xb7'));
   3.267 +		sled.className='off';
   3.268 +		dstat.appendChild(sled);
   3.269 +		dstat.appendChild(document.createTextNode(' '));
   3.270 +		opt_add(opt_color,'Colors');
   3.271 +		opt_color.className='on';
   3.272 +		opt_add(opt_get,'GET');
   3.273 +		opt_add(opt_paste,'Paste');
   3.274 +		opt_add(opt_popup,'New');
   3.275 +		opt_add(opt_close,'Close');
   3.276 +		dstat.appendChild(sdebug);
   3.277 +		dstat.className='stat';
   3.278 +		div.appendChild(dstat);
   3.279 +		div.appendChild(dterm);
   3.280 +		if(opt_color.addEventListener) {
   3.281 +			opt_get.addEventListener('click',do_get,true);
   3.282 +			opt_color.addEventListener('click',do_color,true);
   3.283 +			opt_paste.addEventListener('click',do_paste,true);
   3.284 +			opt_popup.addEventListener('click',do_popup,true);
   3.285 +			opt_close.addEventListener('click',do_close,true);
   3.286 +		} else {
   3.287 +			opt_get.attachEvent("onclick", do_get);
   3.288 +			opt_color.attachEvent("onclick", do_color);
   3.289 +			opt_paste.attachEvent("onclick", do_paste);
   3.290 +			opt_popup.attachEvent("onclick", do_popup);
   3.291 +			opt_close.attachEvent("onclick", do_close);
   3.292 +		}
   3.293 +		document.onkeypress=keypress;
   3.294 +		document.onkeydown=keydown;
   3.295 +		timeout=window.setTimeout(update,100);
   3.296 +		if (document.width <= 25+(width*7)) {
   3.297 +			document.title=prompt("Window title");
   3.298 +		}
   3.299 +	}
   3.300 +	init();
   3.301 +}
   3.302 +ajaxterm.Terminal=function(id,width,height) {
   3.303 +	return new this.Terminal_ctor(id,width,height);
   3.304 +}
   3.305 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ajaxterm/stuff/usr/share/ajaxterm/login	Mon Dec 29 14:27:07 2008 +0000
     4.3 @@ -0,0 +1,14 @@
     4.4 +#!/bin/sh
     4.5 +
     4.6 +server=""
     4.7 +if [ -x /usr/bin/ssh ]; then
     4.8 +	echo -n "Server: "
     4.9 +	read -t 300 server || exit 1
    4.10 +fi
    4.11 +[ -n "$server" ] || exec /bin/login
    4.12 +case "$server" in
    4.13 +*@*);; *) echo -n "$server login: "; read user; server="$user@$server";;
    4.14 +esac
    4.15 +sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null";
    4.16 +[ -L /usr/bin/ssh ] && sshargs=""
    4.17 +exec ssh $sshargs $server