1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-10-18 00:50:07 +00:00

fix(console): fix novncd startup in container and prevent double slashes in websocket url

This commit is contained in:
catborise 2026-09-25 23:11:52 +03:00
parent f061189716
commit d9112b797f
7 changed files with 64 additions and 15 deletions

View file

@ -1,18 +1,28 @@
#!/bin/sh
# `/sbin/setuser www-data` runs the given command as the user `www-data`.
RUNAS=$(which setuser)
[ -z "$RUNAS" ] && RUNAS="$(which sudo) -u"
USER=www-data
USER="www-data"
DJANGO_PROJECT="/srv/webvirtcloud"
PYTHON="$DJANGO_PROJECT/venv/bin/python3"
NOVNCD="$DJANGO_PROJECT/console/novncd"
LOG="/var/log/novncd.log"
DJANGO_PROJECT=/srv/webvirtcloud
PYTHON=$DJANGO_PROJECT/venv/bin/python3
NOVNCD=$DJANGO_PROJECT/console/novncd
cd "$DJANGO_PROJECT" || exit 1
# make novncd debug, verbose
#PARAMS="-d -v"
LOG=/var/log/novncd.log
cd $DJANGO_PROJECT || exit
exec "$RUNAS" "$USER" "$PYTHON" "$NOVNCD" "$PARAMS" >> $LOG 2>&1
if [ -x /sbin/setuser ]; then
if [ -n "$PARAMS" ]; then
# shellcheck disable=SC2086
exec /sbin/setuser "$USER" "$PYTHON" "$NOVNCD" $PARAMS >> "$LOG" 2>&1
else
exec /sbin/setuser "$USER" "$PYTHON" "$NOVNCD" >> "$LOG" 2>&1
fi
elif command -v su >/dev/null 2>&1; then
if [ -n "$PARAMS" ]; then
# shellcheck disable=SC2086
exec su -s /bin/sh "$USER" -c "exec \"$PYTHON\" \"$NOVNCD\" $PARAMS" >> "$LOG" 2>&1
else
exec su -s /bin/sh "$USER" -c "exec \"$PYTHON\" \"$NOVNCD\"" >> "$LOG" 2>&1
fi
fi