wok-current view dropbear/stuff/sshx @ rev 16125
ARM: add xorg-libXdamage and conky
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Mar 23 22:52:11 2014 +0100 (2014-03-23) |
parents | caf768bb46f9 |
children | 58f4bd56c8de |
line source
1 #!/bin/sh
3 xdbclient()
4 {
5 read host data
6 svr=${DISPLAY#*:}
7 n=$((10+($RANDOM % 90))); dpy=localhost:$n
8 scr=${DISPLAY/${DISPLAY%.*}/$dpy}
9 r=""
10 while true; do
11 a="$1"
12 r="$r $1"; shift
13 case "$a" in
14 -[piIlLRWKBJ]) r="$r $1"; shift;;
15 -*) ;;
16 *) break ;;
17 esac
18 done
19 [ -n "$1" ] || set -- "${TERM:-xterm} -ls || ${TERM:-sakura} -l || xterm -ls"
20 exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \
21 "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \
22 </dev/null >/dev/null
23 }
25 pppssh()
26 {
27 [ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " &&
28 read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD
29 for i in $4 ; do
30 echo "route add -net $i dev \$1"
31 done > /etc/ppp/ip-up.d/pppssh$$
32 chmod +x /etc/ppp/ip-up.d/pppssh$$
33 ssh="dbclient -y"
34 $ssh $1 true || exit 1
35 n=10.$(($$%256)).$(($$/256))
36 ppp="/usr/sbin/pppd local noauth nodetach"
37 $ppp ${2:-$n.1:$n.2} passive pty "$ssh $1 $ppp ${3:-proxyarp} notty" \
38 ipparam pppssh$$
39 rm -f /etc/ppp/ip-up.d/pppssh$$
40 }
42 case "$(basename $0)" in
43 ppp*) [ -z "$1" ] && cat <<EOT || pppssh "$@" ;;
44 Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs' 'routes'
45 Example: $0 tux@slitaz.org '' '' '192.168.1.0/24 10.1.2.0/24'
46 EOT
47 *) [ -z "$DISPLAY" ] && exec dbclient "$@"
48 xauth list $DISPLAY | xdbclient "$@"
49 esac