From: Quentin Rameau <quinq@fifth.space>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/busybox/udhcpc.script: fix network interface tag comments
Date: Mon, 9 Dec 2019 00:37:56 +0100 [thread overview]
Message-ID: <20191208233756.GA30928@fifth.space> (raw)
Per Linux man-pages resolv.conf(5): "Lines that contain a semicolon (;)
or hash character (#) in the first column are treated as comments."
---
package/busybox/udhcpc.script | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package/busybox/udhcpc.script b/package/busybox/udhcpc.script
index 711963f974..35b4bead85 100755
--- a/package/busybox/udhcpc.script
+++ b/package/busybox/udhcpc.script
@@ -37,7 +37,7 @@ case "$1" in
# drop info from this interface
# resolv.conf may be a symlink to /tmp/, so take care
TMPFILE=$(mktemp)
- grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
+ sed "/^# $interface$/{N;d;}" $RESOLV_CONF > $TMPFILE
cat $TMPFILE > $RESOLV_CONF
rm -f $TMPFILE
@@ -75,7 +75,7 @@ case "$1" in
# drop info from this interface
# resolv.conf may be a symlink to /tmp/, so take care
TMPFILE=$(mktemp)
- grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
+ sed "/^# $interface$/{N;d;}" $RESOLV_CONF > $TMPFILE
cat $TMPFILE > $RESOLV_CONF
rm -f $TMPFILE
@@ -87,11 +87,11 @@ case "$1" in
fi
[ -n "$search_list" ] &&
- echo "search $search_list # $interface" >> $RESOLV_CONF
+ printf '%s\n' "# $interface" "search $search_list" >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
- echo "nameserver $i # $interface" >> $RESOLV_CONF
+ printf '%s\n' "# $interface" "nameserver $i" >> $RESOLV_CONF
done
;;
esac
--
2.24.0
next reply other threads:[~2019-12-08 23:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-08 23:37 Quentin Rameau [this message]
2019-12-25 22:24 ` [Buildroot] [PATCH] package/busybox/udhcpc.script: fix network interface tag comments Thomas Petazzoni
2019-12-26 6:39 ` Peter Korsgaard
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=20191208233756.GA30928@fifth.space \
--to=quinq@fifth.space \
--cc=buildroot@busybox.net \
/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