From: Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kdump-team-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 2/2] network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf"
Date: Tue, 26 Apr 2016 18:05:11 +0800 [thread overview]
Message-ID: <1461665111-7385-2-git-send-email-xlpang@redhat.com> (raw)
In-Reply-To: <1461665111-7385-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Users can pass the DNS information throught "nameserver=" cmdline,
there maybe duplicated inputs.
"/etc/resolv.conf" have some restrictions on the number of DNS items
effective, so make sure that this file contains no duplicated items.
We achieve this by simply making the file have no duplicated lines.
Signed-off-by: Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/40network/module-setup.sh | 2 +-
modules.d/40network/net-lib.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 4bf93cc..53b4b60 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -23,7 +23,7 @@ installkernel() {
# called by dracut
install() {
local _arch _i _dir
- inst_multiple ip arping dhclient sed
+ inst_multiple ip arping dhclient sed awk
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 31f1a56..005ad1b 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -120,7 +120,7 @@ setup_net() {
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# set up resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && \
- cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
+ awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
# add static route
--
1.8.3.1
next prev parent reply other threads:[~2016-04-26 10:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 10:05 [PATCH 1/2] network: dhcp before parsing specified dns through cmdline Xunlei Pang
[not found] ` <1461665111-7385-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-26 10:05 ` Xunlei Pang [this message]
[not found] ` <1461665111-7385-2-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-26 11:03 ` [PATCH 2/2] network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf" Dracut GitHub Import Bot
2016-06-07 9:16 ` Harald Hoyer
2016-06-07 9:15 ` [PATCH 1/2] network: dhcp before parsing specified dns through cmdline Harald Hoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461665111-7385-2-git-send-email-xlpang@redhat.com \
--to=xlpang-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kdump-team-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox