From 9550220e019bd48391db52d2a6e14ab1256fa7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 18 Mar 2022 22:46:57 +0100 Subject: [PATCH] remmina port optional & fix debug outputs. --- .docker/remmina/run-remmina.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.docker/remmina/run-remmina.sh b/.docker/remmina/run-remmina.sh index 41899b2a..026a322c 100755 --- a/.docker/remmina/run-remmina.sh +++ b/.docker/remmina/run-remmina.sh @@ -16,18 +16,16 @@ if [[ -n "$REMMINA_PROFILE" ]]; then exec remmina -c "$profile" fi -[[ -z "$REMMINA_URL" ]] && err "Neither `REMMINA_PROFILE` nor `REMMINA_URL` found in env vars" +[[ -z "$REMMINA_URL" ]] && err "Neither 'REMMINA_PROFILE' nor 'REMMINA_URL' found in env vars" -readarray -t arr < <( echo -n "$REMMINA_URL" | perl -pe 's|^(\w+\:\/\/)?(\w*:)?(.+@)?([^:]+)(:\d+)?$|\1\n\2\n\3\n\4\n\5|' ) -proto=$(echo "${arr[0]}" | cut -d: -f1) -user=$(echo "${arr[1]}" | cut -d: -f1) -pw=$(echo "${arr[2]}" | cut -d@ -f1) +readarray -t arr < <( echo -n "$REMMINA_URL" | perl -pe 's|^(\w+)\:\/\/(?:([^:]+)(?::([^@]+))?@)?(.*)$|\1\n\2\n\3\n\4|' ) +proto="${arr[0]}" +user="${arr[1]}" +pw="${arr[2]}" host="${arr[3]}" -# port=$(echo "${arr[4]}" | cut -d: -f2) -port="${arr[4]}" #keep the : -echo "Parsed url in `REMMINA_URL`: proto:$proto username:$user host:$host port:$port" +echo "Parsed url in 'REMMINA_URL': proto:$proto username:$user host:$host" -[[ "$proto" != "vnc" && "$proto" != "rdp" && "$proto" != "spice" ]] && err "Unsupported protocol $proto in connection url `REMMINA_URL`" +[[ "$proto" != "vnc" && "$proto" != "rdp" && "$proto" != "spice" ]] && err "Unsupported protocol $proto in connection url 'REMMINA_URL'" profile="$profile_dir"/"$proto".remmina if [[ -n "$pw" ]]; then @@ -37,7 +35,7 @@ else remmina --set-option password= --update-profile "$profile" fi remmina --set-option username="$user" --update-profile "$profile" -remmina --set-option server="$host$port" --update-profile "$profile" +remmina --set-option server="$host" --update-profile "$profile" # remmina --set-option window_maximize=1 --update-profile "$profile" # remmina --set-option scale=1 --update-profile "$profile"