Update alpine-install.func
This commit is contained in:
parent
b099350468
commit
c74738bfcf
@ -101,18 +101,24 @@ setting_up_container() {
|
|||||||
# Apply udhcpc.conf DNS override patch if Alpine
|
# Apply udhcpc.conf DNS override patch if Alpine
|
||||||
CONFIG_FILE="/etc/udhcpc/udhcpc.conf"
|
CONFIG_FILE="/etc/udhcpc/udhcpc.conf"
|
||||||
|
|
||||||
# Remove all RESOLV_CONF= lines (active or commented)
|
# Extract any configured DNS server from /etc/network/interfaces
|
||||||
sed -i '/^#*RESOLV_CONF="/d' "$CONFIG_FILE"
|
DNS_LINE=$(grep -E '^ *dns-nameservers' /etc/network/interfaces 2>/dev/null | awk '{print $2}')
|
||||||
|
|
||||||
# Rebuild file with single correct entry after header
|
# Only patch if DNS is set and not 'host'
|
||||||
awk '
|
if [ -n "$DNS_LINE" ] && [ "$DNS_LINE" != "host" ]; then
|
||||||
/^# Do not overwrite \/etc\/resolv\.conf/ {
|
# Remove all RESOLV_CONF= lines (active or commented)
|
||||||
print
|
sed -i '/^#*RESOLV_CONF="/d' "$CONFIG_FILE"
|
||||||
print "RESOLV_CONF=\"no\""
|
|
||||||
next
|
# Rebuild file with single correct entry after header
|
||||||
}
|
awk '
|
||||||
{ print }
|
/^# Do not overwrite \/etc\/resolv\.conf/ {
|
||||||
' "$CONFIG_FILE" >"${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
print
|
||||||
|
print "RESOLV_CONF=\"no\""
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' "$CONFIG_FILE" >"${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
while [ $i -gt 0 ]; do
|
while [ $i -gt 0 ]; do
|
||||||
if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then
|
if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user