Debian Codegraph @

support/rrsh.sh

raw symbols SCIP
1 #!/bin/sh
2 # abdiff helper: a "remote shell" that emulates an sshd forced-command of
3 # `rrsync DIR`. rsync invokes a remote shell as:
4 # <shell-words...> [ssh-opts] <host> <rsync --server ...>
5 # so when used as -e "sh rrsh.sh <RRSYNC> <DIR>" rsync calls us as:
6 # sh rrsh.sh <RRSYNC> <DIR> [opts] lh rsync --server ...
7 # We hand the server command to rrsync via SSH_ORIGINAL_COMMAND (exactly as
8 # sshd would) and exec the restricted wrapper, so abdiff can A/B the rrsync
9 # path itself. Only the pretend hosts "lh"/"localhost" are accepted.
10 RRSYNC="$1"; DIR="$2"; shift 2
11 while [ $# -gt 0 ]; do
12 case "$1" in
13 -l) shift 2 ;;
14 lh|localhost) shift; break ;;
15 -*) shift ;;
16 *) break ;;
17 esac
18 done
19 SSH_ORIGINAL_COMMAND="$*"
20 export SSH_ORIGINAL_COMMAND
21 exec "$RRSYNC" "$DIR"