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 <xlpang@redhat.com>
master
Xunlei Pang 2016-04-26 18:05:11 +08:00 committed by Harald Hoyer
parent cf376023e6
commit 4fa5c235a7
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ installkernel() {
# called by dracut
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

View File

@ -120,7 +120,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