Compare commits

..

No commits in common. "81cca85faa9f089728a0339a73b84c34e41361d2" and "0a4b2a5fcc95c83f36b7f26143d3c29854e19f4c" have entirely different histories.

View file

@ -18,10 +18,10 @@ default_ssh_port="22"
default_rsp_port="3389" default_rsp_port="3389"
default_vnc_port="5900" default_vnc_port="5900"
Version="2.0.1" Version="2.0.0"
Usage=" Help_message="
$(basename $0) [OPTION] [OPTION=VALUE] PROTOCOL $(basename $0) PROTOCOL [OPTION] [OPTION=VALUE]
script which permit to launch a remote connection protocol. script which permit to launch a remote connection protocol.
@ -56,15 +56,26 @@ start_rsp() {
port="${default_rsp_port}" port="${default_rsp_port}"
fi fi
hostname="${hostname}:${port}" hostname="${hostname}:${port}"
echo "start rsp with user=${user} port=${port} hostname=${hostname}" echo "start rsp"
xfreerdp /v:"${hostname}" /u:"${user}" /dynamic-resolution xfreerdp /v:"${hostname}" /u:"${user}" /dynamic-resolution
} }
# Parser case "$1" in
"ssh")
protocol="ssh"
;;
"rsp")
protocol="rsp"
;;
*)
echo "protocol $1 uknown" >&2
exit 1
esac
# looking for double parametters. # looking for double parametters.
for (( arg=1; arg<$#; arg++)); do for (( arg=2; arg<$#; arg++)); do
value="$((arg+1))" value="$((arg+1))"
if [ "${!arg}" == "-u" ] if [ "${!arg}" == "-u" ]
then then
@ -82,36 +93,24 @@ done
# looking for all parametter alone # looking for all parametter alone
for i in "$@"; do for i in "$@"; do
case "$i" in if [ "${i%=*}" == "--user" ]
"ssh") then
protocol="ssh" user="${i#*=}"
;; elif [ "${i%=*}" == "--port" ]
"rsp") then
protocol="rsp" port="${i#*=}"
;; elif [ "${i#*=}" == "--hostname" ]
"--version" | "-v") then
echo "$(basename $0) v.${Version}" hostname="${i#*=}"
exit 0 elif [ "${i}" == "--version" ] || [ "${i}" == "-v" ]
;; then
"--help" | "-h") echo "$(basename $0) v.${Version}"
echo "${Usage}" exit 0
exit 0 elif [ "${i}" == "--help" ] || [ "${i}" == "-h" ]
;; then
esac echo "$Help_message"
done exit 0
fi
for i in "$@"; do
case "${i%=*}" in
"--user")
user="${i#*=}"
;;
"--port")
port="${i#*=}"
;;
"--hostname")
hostname="${i#*=}"
;;
esac
done done
if [ "${user}" == "" ] if [ "${user}" == "" ]
@ -125,7 +124,6 @@ fi
# Last check, if protocol define, launch it, else, exit 0
case "${protocol}" in case "${protocol}" in
"ssh") "ssh")
start_ssh start_ssh
@ -134,9 +132,8 @@ case "${protocol}" in
start_rsp start_rsp
;; ;;
*) *)
echo "protocol ${protocol} uknown" >&2 echo "CRITICAL protocol ${protocol} uknown" >&2
echo "${Usage}" exit 1
exit
;; ;;
esac esac