mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 16:37:00 +08:00
Compare commits
No commits in common. "4e5dfce9fb615da2aa0a0c5cbfc139d3a032d8a8" and "37abe68d1fa76d4a8ece18fa455a0f858e3645b4" have entirely different histories.
4e5dfce9fb
...
37abe68d1f
22
scripts/riot
22
scripts/riot
|
@ -91,9 +91,8 @@ get_server_meta() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_remote() {
|
|
||||||
# remote setting, including jump servers
|
# remote setting, including jump servers
|
||||||
# called for every remote
|
# will be called only once
|
||||||
# provides:
|
# provides:
|
||||||
SERVER=""
|
SERVER=""
|
||||||
TRUST_SERVER=1
|
TRUST_SERVER=1
|
||||||
|
@ -103,13 +102,13 @@ parse_remote() {
|
||||||
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
||||||
SSH_OPTIONS='-o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes'
|
SSH_OPTIONS='-o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes'
|
||||||
fi
|
fi
|
||||||
# handle input
|
parse_remote() {
|
||||||
local remote="$1"
|
local remote="$1"
|
||||||
local jump_servers=""
|
local jump_servers=""
|
||||||
# loop for jump servers
|
# loop for jump servers
|
||||||
while [[ -n $remote ]]; do
|
while [[ -n $remote ]]; do
|
||||||
local server=${remote%%/*}
|
local server=${remote%%,*}
|
||||||
remote=${remote#*/}
|
remote=${remote#*,}
|
||||||
get_server_meta "$server"
|
get_server_meta "$server"
|
||||||
if [[ -n "$RET_JUMP_SERVER" ]]; then
|
if [[ -n "$RET_JUMP_SERVER" ]]; then
|
||||||
jump_servers="$jump_servers${jump_servers:+,}$RET_JUMP_SERVER"
|
jump_servers="$jump_servers${jump_servers:+,}$RET_JUMP_SERVER"
|
||||||
|
@ -213,14 +212,12 @@ router() {
|
||||||
print_help
|
print_help
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
parse_remote "$1"
|
||||||
IFS=',' read -ra remotes <<< "$1"
|
|
||||||
for remote in "${remotes[@]}"; do
|
|
||||||
if [[ -z "$remote" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
parse_remote "$remote"
|
|
||||||
case $2 in
|
case $2 in
|
||||||
|
-h|--help)
|
||||||
|
print_help
|
||||||
|
exit
|
||||||
|
;;
|
||||||
ssh|"" )
|
ssh|"" )
|
||||||
run_ssh ssh "${@:3}"
|
run_ssh ssh "${@:3}"
|
||||||
;;
|
;;
|
||||||
|
@ -244,7 +241,6 @@ router() {
|
||||||
fmt_fatal "unknown command: $2"
|
fmt_fatal "unknown command: $2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
router "${GOT_OPTS[@]}"
|
router "${GOT_OPTS[@]}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user