Blame 0069-network-net-lib.sh-delete-duplicated-DNS-items-from-.patch

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