wok-6.x diff dropbear/stuff/sshx @ rev 15716
util-linux-eject: add depends,remove post_install
author | Richard Dunbar <mojo@slitaz.org> |
---|---|
date | Wed Dec 25 00:55:35 2013 +0000 (2013-12-25) |
parents | bdff68e2cdc7 |
children | 31599711e814 |
line diff
1.1 --- a/dropbear/stuff/sshx Sat Jan 14 11:56:41 2012 +0100 1.2 +++ b/dropbear/stuff/sshx Wed Dec 25 00:55:35 2013 +0000 1.3 @@ -2,27 +2,43 @@ 1.4 1.5 xdbclient() 1.6 { 1.7 - read host type data 1.8 - svr=$(echo $DISPLAY | sed 's/.*:\([0-9]*\).*/\1/') 1.9 - scr=${DISPLAY/*./.}; [ "$scr" == "$DISPLAY" ] && scr="" 1.10 + read host data 1.11 + svr=${DISPLAY#*:} 1.12 n=$((10+($RANDOM % 90))); dpy=localhost:$n 1.13 - remote="" 1.14 + scr=${DISPLAY/${DISPLAY%.*}/$dpy} 1.15 + r="" 1.16 while true; do 1.17 - arg="$1"; shift 1.18 - remote="$remote $arg" 1.19 - case "$arg" in 1.20 - -[piIlLRWKBJ]) remote="$remote $1"; shift ;; 1.21 + a="$1" 1.22 + r="$r $1"; shift 1.23 + case "$a" in 1.24 + -[piIlLRWKBJ]) r="$r $1"; shift;; 1.25 -*) ;; 1.26 *) break ;; 1.27 esac 1.28 done 1.29 - [ -n "$1" ] || set -- "$TERM || xterm" 1.30 - exec dbclient -f -R $((6000+$n)):localhost:$((6000+$svr)) $remote \ 1.31 - "xauth add $dpy $type $data; export DISPLAY=$dpy$scr; $@ ; xauth remove $dpy" \ 1.32 - < /dev/null > /dev/null 1.33 + [ -n "$1" ] || set -- "${TERM:-false} || xterm -ls" 1.34 + exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \ 1.35 + "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \ 1.36 + </dev/null >/dev/null 1.37 } 1.38 1.39 -case "$DISPLAY" in 1.40 -'') exec dbclient "$@" ;; 1.41 -*) xauth list $DISPLAY | xdbclient "$@" ;; 1.42 +pppssh() 1.43 +{ 1.44 + [ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " && 1.45 + read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD 1.46 + dbclient -y $1 true || exit 1 1.47 + ff=/tmp/pppssh$$ 1.48 + n=10.$(($$%256)).$(($$/256)) 1.49 + ppp="/usr/sbin/pppd local lock notty" 1.50 + mkfifo $ff 1.51 + dbclient -y $1 "$ppp ${3:-proxyarp}" <$ff | $ppp ${2:-$n.1:$n.2} >$ff 1.52 + rm -f $ff 1.53 +} 1.54 + 1.55 +case "$(basename $0)" in 1.56 +ppp*) [ -z "$1" ] && 1.57 + echo "Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs'" || 1.58 + pppssh "$@" ;; 1.59 +*) [ -z "$DISPLAY" ] && exec dbclient "$@" 1.60 + xauth list $DISPLAY | xdbclient "$@" 1.61 esac