wok-6.x annotate dropbear/stuff/sshx @ rev 15625
nut: fix genpkg_rules
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 08 16:00:02 2013 +0000 (2013-12-08) |
parents | bdff68e2cdc7 |
children | 31599711e814 |
rev | line source |
---|---|
pascal@10917 | 1 #!/bin/sh |
pascal@10917 | 2 |
pascal@10917 | 3 xdbclient() |
pascal@10917 | 4 { |
pascal@14027 | 5 read host data |
pascal@14027 | 6 svr=${DISPLAY#*:} |
pascal@11597 | 7 n=$((10+($RANDOM % 90))); dpy=localhost:$n |
pascal@14027 | 8 scr=${DISPLAY/${DISPLAY%.*}/$dpy} |
pascal@14027 | 9 r="" |
pascal@11597 | 10 while true; do |
pascal@14027 | 11 a="$1" |
pascal@14027 | 12 r="$r $1"; shift |
pascal@14027 | 13 case "$a" in |
pascal@14027 | 14 -[piIlLRWKBJ]) r="$r $1"; shift;; |
pascal@11597 | 15 -*) ;; |
pascal@11597 | 16 *) break ;; |
pascal@11597 | 17 esac |
pascal@11597 | 18 done |
pascal@14027 | 19 [ -n "$1" ] || set -- "${TERM:-false} || xterm -ls" |
pascal@14027 | 20 exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \ |
pascal@14027 | 21 "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \ |
pascal@14027 | 22 </dev/null >/dev/null |
pascal@10917 | 23 } |
pascal@10917 | 24 |
pascal@14027 | 25 pppssh() |
pascal@14027 | 26 { |
pascal@14027 | 27 [ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " && |
pascal@14027 | 28 read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD |
pascal@14027 | 29 dbclient -y $1 true || exit 1 |
pascal@14027 | 30 ff=/tmp/pppssh$$ |
pascal@14027 | 31 n=10.$(($$%256)).$(($$/256)) |
pascal@14027 | 32 ppp="/usr/sbin/pppd local lock notty" |
pascal@14027 | 33 mkfifo $ff |
pascal@14027 | 34 dbclient -y $1 "$ppp ${3:-proxyarp}" <$ff | $ppp ${2:-$n.1:$n.2} >$ff |
pascal@14027 | 35 rm -f $ff |
pascal@14027 | 36 } |
pascal@14027 | 37 |
pascal@14027 | 38 case "$(basename $0)" in |
pascal@14027 | 39 ppp*) [ -z "$1" ] && |
pascal@14027 | 40 echo "Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs'" || |
pascal@14027 | 41 pppssh "$@" ;; |
pascal@14027 | 42 *) [ -z "$DISPLAY" ] && exec dbclient "$@" |
pascal@14027 | 43 xauth list $DISPLAY | xdbclient "$@" |
pascal@10917 | 44 esac |