diff --git a/apps/remmina/run-remmina.sh b/apps/remmina/run-remmina.sh index a9817805..f2d22979 100755 --- a/apps/remmina/run-remmina.sh +++ b/apps/remmina/run-remmina.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -u err() { echo "ERROR: $*" >&2 @@ -16,23 +15,28 @@ if [[ -n "$REMMINA_PROFILE" ]]; then exec remmina -c "$profile" fi -[[ -z "$REMMINA_URL" ]] && err "Neither 'REMMINA_PROFILE' nor 'REMMINA_URL' found in env vars" +if [[ ! -z "$REMMINA_URL" ]]; then + 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]}" + echo "Parsed url in 'REMMINA_URL': proto:$proto username:$user host:$host" -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]}" -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 + remmina --set-option username="$user" --update-profile "$profile" + remmina --set-option password="$pw" --update-profile "$profile" + remmina --set-option server="$host" --update-profile "$profile" -profile="$profile_dir"/"$proto".remmina -remmina --set-option username="$user" --update-profile "$profile" -remmina --set-option password="$pw" --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" -# remmina --set-option window_maximize=1 --update-profile "$profile" -# remmina --set-option scale=1 --update-profile "$profile" + echo "Running remmina with URL $REMMINA_URL" + exec remmina -c "$profile" +fi -exec remmina -c "$profile" + +echo "Running remmina without connection profile" +exec remmina