From ac7286e4c6dd79051071fa1ab690a637940463bc Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 7 May 2025 08:17:10 +0200 Subject: [PATCH] Update alpine-install.func --- misc/alpine-install.func | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/misc/alpine-install.func b/misc/alpine-install.func index b6daa17..af97671 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -98,21 +98,17 @@ msg_error() { setting_up_container() { msg_info "Setting up Container OS" - if [ "$UDHCPC_FIX" == "yes" ]; then - CONFIG_FILE="/etc/udhcpc/udhcpc.conf" - echo -e "${INFO}${YW}[DEBUG] UDHCPC_FIX is set. Patching $CONFIG_FILE${CL}" - - if grep -q '^#RESOLV_CONF=' "$CONFIG_FILE"; then - sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' "$CONFIG_FILE" - echo -e "${INFO}${YW}[DEBUG] Uncommented existing RESOLV_CONF line${CL}" - elif ! grep -q '^RESOLV_CONF=' "$CONFIG_FILE"; then - echo 'RESOLV_CONF="no"' >>"$CONFIG_FILE" - echo -e "${INFO}${YW}[DEBUG] Added new RESOLV_CONF line${CL}" - else - echo -e "${INFO}${YW}[DEBUG] RESOLV_CONF already set. No action taken.${CL}" + if grep -qi 'alpine' /etc/os-release; then + if [ -f /etc/network/interfaces ]; then + NS_LINE=$(grep -E 'dns-nameservers' /etc/network/interfaces || true) + if echo "$NS_LINE" | grep -vq 'host'; then + if grep -q '^#RESOLV_CONF=' /etc/udhcpc/udhcpc.conf; then + msg_info "Patching udhcpc.conf to prevent DNS override" + sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' /etc/udhcpc/udhcpc.conf + msg_ok "Patched udhcpc.conf" + fi + fi fi - else - echo -e "${INFO}${YW}[DEBUG] UDHCPC_FIX not required. Skipping patch.${CL}" fi while [ $i -gt 0 ]; do