Update alpine-install.func
This commit is contained in:
parent
ac7286e4c6
commit
2fc8d08cec
@ -99,15 +99,18 @@ setting_up_container() {
|
|||||||
msg_info "Setting up Container OS"
|
msg_info "Setting up Container OS"
|
||||||
|
|
||||||
if grep -qi 'alpine' /etc/os-release; then
|
if grep -qi 'alpine' /etc/os-release; then
|
||||||
if [ -f /etc/network/interfaces ]; then
|
CONFIG_FILE="/etc/udhcpc/udhcpc.conf"
|
||||||
NS_LINE=$(grep -E 'dns-nameservers' /etc/network/interfaces || true)
|
if grep -q '^RESOLV_CONF="no"' "$CONFIG_FILE"; then
|
||||||
if echo "$NS_LINE" | grep -vq 'host'; then
|
echo -e "${INFO}${YW}[DEBUG] RESOLV_CONF already set correctly. No changes.${CL}"
|
||||||
if grep -q '^#RESOLV_CONF=' /etc/udhcpc/udhcpc.conf; then
|
elif grep -q '^#RESOLV_CONF=' "$CONFIG_FILE"; then
|
||||||
msg_info "Patching udhcpc.conf to prevent DNS override"
|
sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' "$CONFIG_FILE"
|
||||||
sed -i 's/^#RESOLV_CONF=.*/RESOLV_CONF="no"/' /etc/udhcpc/udhcpc.conf
|
echo -e "${INFO}${YW}[DEBUG] Uncommented and set RESOLV_CONF=\"no\"${CL}"
|
||||||
msg_ok "Patched udhcpc.conf"
|
elif grep -q '^RESOLV_CONF=' "$CONFIG_FILE"; then
|
||||||
fi
|
sed -i 's/^RESOLV_CONF=.*/RESOLV_CONF="no"/' "$CONFIG_FILE"
|
||||||
fi
|
echo -e "${INFO}${YW}[DEBUG] Overwrote existing RESOLV_CONF=... line${CL}"
|
||||||
|
else
|
||||||
|
echo 'RESOLV_CONF="no"' >>"$CONFIG_FILE"
|
||||||
|
echo -e "${INFO}${YW}[DEBUG] Added RESOLV_CONF=\"no\" at EOF${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user