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

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