From 52d3aaaf0ff54bed33e13a72b8a4a8c5ca2c749d Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 5 May 2025 16:09:48 +0200 Subject: [PATCH] Set DNS Options for Alpine --- misc/alpine-install.func | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/misc/alpine-install.func b/misc/alpine-install.func index d3eeaed..29e4e8a 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -194,4 +194,16 @@ customize() { fi echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update + + NS_VALUE=$(echo "$PCT_OPTIONS" | grep -oP '(?<=-nameserver=)[^\s]+') + + if [ "$NS_VALUE" != "" ] && [ "$NS_VALUE" != "Host" ]; then + + CONFIG_FILE="/etc/udhcpc/udhcpc.conf" + if grep -q '^RESOLV_CONF=' "$CONFIG_FILE"; then + sed -i 's/^RESOLV_CONF=.*/RESOLV_CONF=no/' "$CONFIG_FILE" + else + echo 'RESOLV_CONF=no' >>"$CONFIG_FILE" + fi + fi }