Skip to content

Commit eef3359

Browse files
authored
utils/novnc_proxy: Allow spaces in script arguments
1 parent bbb6a5b commit eef3359

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

utils/novnc_proxy

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ while [ "$*" ]; do
9999
--syslog) SYSLOG_ARG="--syslog ${OPTARG}"; shift ;;
100100
--heartbeat) HEARTBEAT_ARG="--heartbeat ${OPTARG}"; shift ;;
101101
--idle-timeout) IDLETIMEOUT_ARG="--idle-timeout ${OPTARG}"; shift ;;
102-
--timeout) TIMEOUT_ARG="--timeout ${OPTARG}"; shift ;;
102+
--timeout) TIMEOUT_ARG="${OPTARG}"; shift ;;
103103
--web-auth) WEBAUTH_ARG="--web-auth" ;;
104104
--auth-plugin) AUTHPLUGIN_ARG="--auth-plugin ${OPTARG}"; shift ;;
105105
--auth-source) AUTHSOURCE_ARG="--auth-source ${OPTARG}"; shift ;;
@@ -138,11 +138,11 @@ if [ -n "${WEB}" ]; then
138138
elif [ -e "$(pwd)/vnc.html" ]; then
139139
WEB=$(pwd)
140140
elif [ -e "${HERE}/../vnc.html" ]; then
141-
WEB=${HERE}/../
141+
WEB="${HERE}/../"
142142
elif [ -e "${HERE}/vnc.html" ]; then
143-
WEB=${HERE}
143+
WEB="${HERE}"
144144
elif [ -e "${HERE}/../share/novnc/vnc.html" ]; then
145-
WEB=${HERE}/../share/novnc/
145+
WEB="${HERE}/../share/novnc/"
146146
else
147147
die "Could not find vnc.html"
148148
fi
@@ -170,11 +170,11 @@ if [ -n "${KEY}" ]; then
170170
fi
171171

172172
# try to find websockify (prefer local, try global, then download local)
173-
if [[ -d ${HERE}/websockify ]]; then
174-
WEBSOCKIFY=${HERE}/websockify/run
173+
if [[ -d "${HERE}/websockify" ]]; then
174+
WEBSOCKIFY="${HERE}/websockify/run"\
175175

176176
if [[ ! -x $WEBSOCKIFY ]]; then
177-
echo "The path ${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
177+
echo "The path "${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
178178
echo "If you intended to use an installed websockify package, please remove ${HERE}/websockify."
179179
exit 1
180180
fi
@@ -209,7 +209,7 @@ WEB=`realpath "${WEB}"`
209209
[ -n "${RECORD}" ] && RECORD=`realpath "${RECORD}"`
210210
211211
echo "Starting webserver and WebSockets proxy on${HOST:+ host ${HOST}} port ${PORT}"
212-
${WEBSOCKIFY} ${SYSLOG_ARG} ${SSLONLY} ${FILEONLY_ARG} --web ${WEB} ${CERT:+--cert ${CERT}} ${KEY:+--key ${KEY}} ${LISTEN} ${VNC_DEST} ${HEARTBEAT_ARG} ${IDLETIMEOUT_ARG} ${RECORD:+--record ${RECORD}} ${TIMEOUT_ARG} ${WEBAUTH_ARG} ${AUTHPLUGIN_ARG} ${AUTHSOURCE_ARG} &
212+
"${WEBSOCKIFY}" ${SYSLOG_ARG:+--syslog "${SYSLOG_ARG}"} ${SSLONLY} ${FILEONLY_ARG} --web ${WEB} ${CERT:+--cert "${CERT}"} ${KEY:+--key "${KEY}"} "${LISTEN}" "${VNC_DEST}" ${HEARTBEAT_ARG} ${IDLETIMEOUT_ARG} ${RECORD:+--record "${RECORD}"} ${TIMEOUT_ARG:+--timeout "${TIMEOUT_ARG}"} ${WEBAUTH_ARG} ${AUTHPLUGIN_ARG} ${AUTHSOURCE_ARG} &
213213
proxy_pid="$!"
214214
sleep 1
215215
if [ -z "$proxy_pid" ] || ! ps -eo pid= | grep -w "$proxy_pid" > /dev/null; then
@@ -219,7 +219,7 @@ if [ -z "$proxy_pid" ] || ! ps -eo pid= | grep -w "$proxy_pid" > /dev/null; then
219219
fi
220220
221221
if [ -z "$HOST" ]; then
222-
HOST=$(hostname)
222+
HOST="$(hostname)"
223223
fi
224224
225225
echo -e "\n\nNavigate to this URL:\n"

0 commit comments

Comments
 (0)