Update alpine-install.func

This commit is contained in:
CanbiZ 2025-05-07 08:17:10 +02:00
parent 5dc031fbe2
commit ac7286e4c6

View File

@ -98,21 +98,17 @@ msg_error() {
setting_up_container() { setting_up_container() {
msg_info "Setting up Container OS" msg_info "Setting up Container OS"
if [ "$UDHCPC_FIX" == "yes" ]; then if grep -qi 'alpine' /etc/os-release; then
CONFIG_FILE="/etc/udhcpc/udhcpc.conf" if [ -f /etc/network/interfaces ]; then
echo -e "${INFO}${YW}[DEBUG] UDHCPC_FIX is set. Patching $CONFIG_FILE${CL}" NS_LINE=$(grep -E 'dns-nameservers' /etc/network/interfaces || true)
if echo "$NS_LINE" | grep -vq 'host'; then
if grep -q '^#RESOLV_CONF=' "$CONFIG_FILE"; then if grep -q '^#RESOLV_CONF=' /etc/udhcpc/udhcpc.conf; then
sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' "$CONFIG_FILE" msg_info "Patching udhcpc.conf to prevent DNS override"
echo -e "${INFO}${YW}[DEBUG] Uncommented existing RESOLV_CONF line${CL}" sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' /etc/udhcpc/udhcpc.conf
elif ! grep -q '^RESOLV_CONF=' "$CONFIG_FILE"; then msg_ok "Patched udhcpc.conf"
echo 'RESOLV_CONF="no"' >>"$CONFIG_FILE" fi
echo -e "${INFO}${YW}[DEBUG] Added new RESOLV_CONF line${CL}" fi
else
echo -e "${INFO}${YW}[DEBUG] RESOLV_CONF already set. No action taken.${CL}"
fi fi
else
echo -e "${INFO}${YW}[DEBUG] UDHCPC_FIX not required. Skipping patch.${CL}"
fi fi
while [ $i -gt 0 ]; do while [ $i -gt 0 ]; do