From 2f3098a18d7560cb6539df45af6870a95bee8a43 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:23:28 +0200 Subject: [PATCH 1/6] Support older kernels --- run/run.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run/run.sh b/run/run.sh index 8cc935f..126aecb 100755 --- a/run/run.sh +++ b/run/run.sh @@ -3,7 +3,7 @@ set -eu # Docker environment variabeles -: ${URL:=''}. # URL of the PAT file +: ${URL:=''} # URL of the PAT file : ${DEBUG:=''}. # Enable debug mode : ${ALLOCATE:='Y'} # Preallocate diskspace : ${CPU_CORES:='1'} # Amount of CPU cores @@ -67,4 +67,8 @@ set -m ) set +m -pidwait -F "${_QEMU_PID}" & wait $! +if (( $(echo "$(uname -r | cut -d '.' -f 1-2) > 5.2" |bc -l) )); then + pidwait -F "${_QEMU_PID}" & wait $! +else + tail --pid "$(cat ${_QEMU_PID})" --follow /dev/null & wait $! +fi From 979adebebae29c8a0a4fed0ff2ff3082ce790826 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:27:25 +0200 Subject: [PATCH 2/6] Add bc --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 4cf0cc8..28cede6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ FROM debian:bookworm-20230411-slim RUN apt-get update && apt-get -y upgrade && \ apt-get --no-install-recommends -y install \ + bc \ curl \ cpio \ wget \ From fdbaccab14d44a855d91a5c646ce4906e86d7fc4 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:36:16 +0200 Subject: [PATCH 3/6] Remove bc --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 28cede6..4cf0cc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ FROM debian:bookworm-20230411-slim RUN apt-get update && apt-get -y upgrade && \ apt-get --no-install-recommends -y install \ - bc \ curl \ cpio \ wget \ From ba9d814219cd8db47f36d001a496600216fb7761 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:38:55 +0200 Subject: [PATCH 4/6] Detect kernel version --- run/run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run/run.sh b/run/run.sh index 126aecb..abe5589 100755 --- a/run/run.sh +++ b/run/run.sh @@ -13,6 +13,8 @@ set -eu echo "Starting Virtual DSM for Docker v${VERSION}..." STORAGE="/storage" +KERNEL=$(uname -r | cut -b 1) + [ ! -d "$STORAGE" ] && echo "Storage folder (${STORAGE}) not found!" && exit 69 [ ! -f "/run/run.sh" ] && echo "Script must run inside Docker container!" && exit 60 @@ -67,7 +69,7 @@ set -m ) set +m -if (( $(echo "$(uname -r | cut -d '.' -f 1-2) > 5.2" |bc -l) )); then +if (( KERNEL > 4 )); then pidwait -F "${_QEMU_PID}" & wait $! else tail --pid "$(cat ${_QEMU_PID})" --follow /dev/null & wait $! From c97735f567f792cd87ba553fdc8e808d11f7d870 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:40:03 +0200 Subject: [PATCH 5/6] Check kernel version --- run/network.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run/network.sh b/run/network.sh index 1df4c84..63cfed2 100644 --- a/run/network.sh +++ b/run/network.sh @@ -112,8 +112,10 @@ configureNAT () { iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p tcp -j DNAT --to $VM_NET_IP iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p udp -j DNAT --to $VM_NET_IP - # Hack for guest VMs complaining about "bad udp checksums in 5 packets" - iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill || true + if (( KERNEL > 4 )); then + # Hack for guest VMs complaining about "bad udp checksums in 5 packets" + iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill || true + fi #Enable port forwarding flag [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]] && sysctl -w net.ipv4.ip_forward=1 From 9c4a000d403ed1d4944b670c32241c71c25501ab Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 01:43:02 +0200 Subject: [PATCH 6/6] Dot --- run/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/run.sh b/run/run.sh index abe5589..1c7734d 100755 --- a/run/run.sh +++ b/run/run.sh @@ -4,7 +4,7 @@ set -eu # Docker environment variabeles : ${URL:=''} # URL of the PAT file -: ${DEBUG:=''}. # Enable debug mode +: ${DEBUG:=''} # Enable debug mode : ${ALLOCATE:='Y'} # Preallocate diskspace : ${CPU_CORES:='1'} # Amount of CPU cores : ${DISK_SIZE:='16G'} # Initial data disk size