From: Xunlei Pang Date: Tue, 26 Apr 2016 10:05:11 +0000 (+0800) Subject: network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf" X-Git-Tag: 033-502~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3204225884ba63aee94db345d5c38f1c872d6b7;p=thirdparty%2Fdracut.git network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf" Users can pass the DNS information throught "nameserver=" cmdline, there maybe duplicated inputs. "/etc/resolv.conf" have some restrictions on the number of DNS items effective, so make sure that this file contains no duplicated items. We achieve this by simply making the file have no duplicated lines. Signed-off-by: Xunlei Pang (cherry picked from commit 4fa5c235a76c085f5958002826436ed9c40e5034) --- diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh index 75ce62243..de3536743 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -69,7 +69,7 @@ installkernel() { install() { local _arch _i _dir - inst_multiple ip arping dhclient sed + inst_multiple ip arping dhclient sed awk inst_multiple -o ping ping6 inst_multiple -o brctl inst_multiple -o teamd teamdctl teamnl diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 92154cc6a..e6942a55d 100755 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -121,7 +121,7 @@ setup_net() { [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts # set up resolv.conf [ -e /tmp/net.$netif.resolv.conf ] && \ - cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf + awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw # add static route