Blame SOURCES/0416-network-net-lib.sh-delete-duplicated-DNS-items-from-.patch

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