Blame 0082-Revert-network-remove-awk-call-and-replace-it-with-a.patch

Harald Hoyer 414eba
From 9e19c0512d12be15d02125bce0e25d6b9bb2b333 Mon Sep 17 00:00:00 2001
Harald Hoyer 414eba
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 414eba
Date: Tue, 7 Jun 2016 13:24:47 +0200
Harald Hoyer 414eba
Subject: [PATCH] Revert "network: remove awk call and replace it with a shell
Harald Hoyer 414eba
 function"
Harald Hoyer 414eba
Harald Hoyer 414eba
This reverts commit 71867b665cea6b4d9814ea0386baf0500db06806.
Harald Hoyer 414eba
Harald Hoyer 414eba
network needs posix shell
Harald Hoyer 414eba
---
Harald Hoyer 414eba
 dracut-functions.sh                 | 10 ----------
Harald Hoyer 414eba
 modules.d/40network/module-setup.sh |  2 +-
Harald Hoyer 414eba
 modules.d/40network/net-lib.sh      |  2 +-
Harald Hoyer 414eba
 3 files changed, 2 insertions(+), 12 deletions(-)
Harald Hoyer 414eba
Harald Hoyer 414eba
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer 414eba
index 146dbea..4496bfe 100755
Harald Hoyer 414eba
--- a/dracut-functions.sh
Harald Hoyer 414eba
+++ b/dracut-functions.sh
Harald Hoyer 414eba
@@ -37,16 +37,6 @@ str_starts() { [ "${1#"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 # returns OK if $1 contains literal string $2 at the end, and isn't empty
Harald Hoyer 414eba
 str_ends() { [ "${1%*"$2"}" != "$1" ]; }
Harald Hoyer 414eba
 
Harald Hoyer 414eba
-uniq_lines() {
Harald Hoyer 414eba
-    local -A lines
Harald Hoyer 414eba
-    while read -r line; do
Harald Hoyer 414eba
-        if ! [[ ${lines[$line]} ]]; then
Harald Hoyer 414eba
-            echo "$line"
Harald Hoyer 414eba
-            lines[$line]=1
Harald Hoyer 414eba
-        fi
Harald Hoyer 414eba
-    done
Harald Hoyer 414eba
-}
Harald Hoyer 414eba
-
Harald Hoyer 414eba
 # find a binary.  If we were not passed the full path directly,
Harald Hoyer 414eba
 # search in the usual places to find the binary.
Harald Hoyer 414eba
 find_binary() {
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 4fd274e..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
-        uniq_lines < /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