fix: Remove VNC support (#540)

* fix: Remove VNC support
This commit is contained in:
Kroese 2024-01-05 00:02:49 +01:00 committed by GitHub
parent fd4bc28835
commit 2627d320f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 35 deletions

View File

@ -6,21 +6,14 @@ set -Eeuo pipefail
: ${GPU:='N'} # GPU passthrough : ${GPU:='N'} # GPU passthrough
: ${DISPLAY:='none'} # Display type : ${DISPLAY:='none'} # Display type
case "${DISPLAY,,}" in
vnc)
DISPLAY_OPTS="-display vnc=:0 -vga virtio"
;;
*)
DISPLAY_OPTS="-display $DISPLAY -vga none"
;;
esac
if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
DISPLAY_OPTS="-display $DISPLAY -vga none"
return 0 return 0
fi fi
DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128 -vga virtio" DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128 -vga virtio"
[[ "${DISPLAY,,}" == "vnc" ]] && DISPLAY_OPTS="$DISPLAY_OPTS -vnc :0"
[ ! -d /dev/dri ] && mkdir -m 755 /dev/dri [ ! -d /dev/dri ] && mkdir -m 755 /dev/dri

View File

@ -4,7 +4,6 @@ set -Eeuo pipefail
# Docker environment variables # Docker environment variables
: ${DHCP:='N'} : ${DHCP:='N'}
: ${HOST_PORTS:=''}
: ${MAC:='02:11:32:AA:BB:CC'} : ${MAC:='02:11:32:AA:BB:CC'}
: ${VM_NET_DEV:=''} : ${VM_NET_DEV:=''}
@ -91,26 +90,6 @@ configureDNS() {
return 0 return 0
} }
getPorts() {
local list=$1
local vnc="5900"
if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
[ -z "$list" ] && list="$vnc" || list="$list,$vnc"
fi
[ -z "$list" ] && return 0
if [[ "$list" != *","* ]]; then
echo " ! --dport $list"
else
echo " -m multiport ! --dports $list"
fi
return 0
}
configureNAT() { configureNAT() {
# Create the necessary file structure for /dev/net/tun # Create the necessary file structure for /dev/net/tun
@ -165,11 +144,8 @@ configureNAT() {
update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null
exclude="$(getPorts "$HOST_PORTS")"
iptables -t nat -A POSTROUTING -o "$VM_NET_DEV" -j MASQUERADE iptables -t nat -A POSTROUTING -o "$VM_NET_DEV" -j MASQUERADE
# shellcheck disable=SC2086 iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p tcp -j DNAT --to "$VM_NET_IP"
iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p tcp${exclude} -j DNAT --to "$VM_NET_IP"
iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p udp -j DNAT --to "$VM_NET_IP" iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p udp -j DNAT --to "$VM_NET_IP"
if (( KERNEL > 4 )); then if (( KERNEL > 4 )); then