Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/novnc_proxy: Allow spaces in script arguments #1891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions utils/novnc_proxy
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ while [ "$*" ]; do
--syslog) SYSLOG_ARG="--syslog ${OPTARG}"; shift ;;
--heartbeat) HEARTBEAT_ARG="--heartbeat ${OPTARG}"; shift ;;
--idle-timeout) IDLETIMEOUT_ARG="--idle-timeout ${OPTARG}"; shift ;;
--timeout) TIMEOUT_ARG="--timeout ${OPTARG}"; shift ;;
--timeout) TIMEOUT_ARG="${OPTARG}"; shift ;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More variables need to be adjusted this way up here.

--web-auth) WEBAUTH_ARG="--web-auth" ;;
--auth-plugin) AUTHPLUGIN_ARG="--auth-plugin ${OPTARG}"; shift ;;
--auth-source) AUTHSOURCE_ARG="--auth-source ${OPTARG}"; shift ;;
Expand Down Expand Up @@ -138,11 +138,11 @@ if [ -n "${WEB}" ]; then
elif [ -e "$(pwd)/vnc.html" ]; then
WEB=$(pwd)
elif [ -e "${HERE}/../vnc.html" ]; then
WEB=${HERE}/../
WEB="${HERE}/../"
elif [ -e "${HERE}/vnc.html" ]; then
WEB=${HERE}
WEB="${HERE}"
elif [ -e "${HERE}/../share/novnc/vnc.html" ]; then
WEB=${HERE}/../share/novnc/
WEB="${HERE}/../share/novnc/"
else
die "Could not find vnc.html"
fi
Expand Down Expand Up @@ -170,11 +170,11 @@ if [ -n "${KEY}" ]; then
fi

# try to find websockify (prefer local, try global, then download local)
if [[ -d ${HERE}/websockify ]]; then
WEBSOCKIFY=${HERE}/websockify/run
if [[ -d "${HERE}/websockify" ]]; then
WEBSOCKIFY="${HERE}/websockify/run"\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A stray backslash here.


if [[ ! -x $WEBSOCKIFY ]]; then
echo "The path ${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
echo "The path "${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not needed, and not correct.

echo "If you intended to use an installed websockify package, please remove ${HERE}/websockify."
exit 1
fi
Expand Down Expand Up @@ -209,7 +209,7 @@ WEB=`realpath "${WEB}"`
[ -n "${RECORD}" ] && RECORD=`realpath "${RECORD}"`

echo "Starting webserver and WebSockets proxy on${HOST:+ host ${HOST}} port ${PORT}"
${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} &
"${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} &
proxy_pid="$!"
sleep 1
if [ -z "$proxy_pid" ] || ! ps -eo pid= | grep -w "$proxy_pid" > /dev/null; then
Expand All @@ -219,7 +219,7 @@ if [ -z "$proxy_pid" ] || ! ps -eo pid= | grep -w "$proxy_pid" > /dev/null; then
fi

if [ -z "$HOST" ]; then
HOST=$(hostname)
HOST="$(hostname)"
fi

echo -e "\n\nNavigate to this URL:\n"
Expand Down