diff --git a/misc/alpine-install.func b/misc/alpine-install.func index 3be72d0..c49e1ce 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -97,6 +97,19 @@ msg_error() { # This function sets up the Container OS by generating the locale, setting the timezone, and checking the network connection setting_up_container() { msg_info "Setting up Container OS" + + NS_VALUE=$(echo "$PCT_OPTIONS" | sed -n 's/.*-nameserver=\([^ ]*\).*/\1/p') + + 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 + while [ $i -gt 0 ]; do if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then break @@ -195,15 +208,4 @@ customize() { 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" | sed -n 's/.*-nameserver=\([^ ]*\).*/\1/p') - - 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 }