From 361f6055fbca9835ec29607a86586b1c5634e2f7 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 7 Jan 2024 23:05:50 +0100 Subject: [PATCH] feat: Add webbased display (#307) --- Dockerfile | 2 -- src/display.sh | 7 ++++++- src/entry.sh | 2 +- src/network.sh | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2cb4b55a..7b7ba061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,12 @@ RUN apt-get update \ tini \ wget \ ovmf \ - novnc \ procps \ iptables \ iproute2 \ dnsmasq \ net-tools \ qemu-utils \ - websockify \ ca-certificates \ netcat-openbsd \ qemu-system-x86 \ diff --git a/src/display.sh b/src/display.sh index 0fc2b2ca..3aca9399 100644 --- a/src/display.sh +++ b/src/display.sh @@ -10,6 +10,11 @@ case "${DISPLAY,,}" in vnc) DISPLAY_OPTS="-display vnc=:0 -vga virtio" ;; + web) + addPackage "novnc" "NoVNC" + addPackage "websockify" "Websockify" + DISPLAY_OPTS="-display vnc=:0 -vga virtio" + ;; *) DISPLAY_OPTS="-display $DISPLAY -vga none" ;; @@ -20,7 +25,7 @@ if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then fi DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128 -vga virtio" -[[ "${DISPLAY,,}" == "vnc" ]] && DISPLAY_OPTS="$DISPLAY_OPTS -vnc :0" +[[ "${DISPLAY,,}" == "vnc" || "${DISPLAY,,}" == "web" ]] && DISPLAY_OPTS="$DISPLAY_OPTS -vnc :0" [ ! -d /dev/dri ] && mkdir -m 755 /dev/dri diff --git a/src/entry.sh b/src/entry.sh index 538e57f1..ebb9e9e4 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -17,7 +17,7 @@ cd /run trap - ERR -if [[ "${DISPLAY,,}" == "vnc" ]]; then +if [[ "${DISPLAY,,}" == "web" ]]; then websockify -D --web /usr/share/novnc/ 8006 localhost:5900 fi diff --git a/src/network.sh b/src/network.sh index c5c9727e..47f97790 100644 --- a/src/network.sh +++ b/src/network.sh @@ -98,6 +98,10 @@ getPorts() { local novnc="8006" if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then + [ -z "$list" ] && list="$vnc" || list="$list,$vnc" + fi + + if [[ "${DISPLAY,,}" == "web" ]] && [[ "$list" != *"$novnc"* ]]; then [ -z "$list" ] && list="$vnc,$novnc" || list="$list,$vnc,$novnc" fi