712866
From a3204225884ba63aee94db345d5c38f1c872d6b7 Mon Sep 17 00:00:00 2001
712866
From: Xunlei Pang <xlpang@redhat.com>
712866
Date: Tue, 26 Apr 2016 18:05:11 +0800
712866
Subject: [PATCH] network/net-lib.sh: delete duplicated DNS items from
712866
 "/etc/resolv.conf"
712866
712866
Users can pass the DNS information throught "nameserver=" cmdline,
712866
there maybe duplicated inputs.
712866
712866
"/etc/resolv.conf" have some restrictions on the number of DNS items
712866
effective, so make sure that this file contains no duplicated items.
712866
712866
We achieve this by simply making the file have no duplicated lines.
712866
712866
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
712866
(cherry picked from commit 4fa5c235a76c085f5958002826436ed9c40e5034)
712866
---
712866
 modules.d/40network/module-setup.sh | 2 +-
712866
 modules.d/40network/net-lib.sh      | 2 +-
712866
 2 files changed, 2 insertions(+), 2 deletions(-)
712866
712866
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
5c6c2a
index 75ce6224..de353674 100755
712866
--- a/modules.d/40network/module-setup.sh
712866
+++ b/modules.d/40network/module-setup.sh
712866
@@ -69,7 +69,7 @@ installkernel() {
712866
 
712866
 install() {
712866
     local _arch _i _dir
712866
-    inst_multiple ip arping dhclient sed
712866
+    inst_multiple ip arping dhclient sed awk
712866
     inst_multiple -o ping ping6
712866
     inst_multiple -o brctl
712866
     inst_multiple -o teamd teamdctl teamnl
712866
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
5c6c2a
index 92154cc6..e6942a55 100755
712866
--- a/modules.d/40network/net-lib.sh
712866
+++ b/modules.d/40network/net-lib.sh
712866
@@ -121,7 +121,7 @@ setup_net() {
712866
     [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
712866
     # set up resolv.conf
712866
     [ -e /tmp/net.$netif.resolv.conf ] && \
712866
-        cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
712866
+        awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
712866
     [ -e /tmp/net.$netif.gw ]            && . /tmp/net.$netif.gw
712866
 
712866
     # add static route