From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 9/9] defaultenv: resolve global.net.server before using it
Date: Mon, 7 Jan 2019 08:40:08 +0100 [thread overview]
Message-ID: <20190107074008.3797-10-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190107074008.3797-1-s.hauer@pengutronix.de>
global.net.server may contain a hostname, so we have to resolve it
before using it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/Kconfig | 1 +
defaultenv/defaultenv-2-base/boot/net | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/common/Kconfig b/common/Kconfig
index 1c2669084a..b522a86ad4 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -867,6 +867,7 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW
select CMD_BOOT
select NET_CMD_IFUP if NET
select CMD_IP_ROUTE_GET if NET
+ select CMD_HOST if NET
config DEFAULT_ENVIRONMENT_GENERIC
bool "Generic environment template (old version)"
diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net
index 840e9fc1f0..f8895290ad 100644
--- a/defaultenv/defaultenv-2-base/boot/net
+++ b/defaultenv/defaultenv-2-base/boot/net
@@ -9,7 +9,13 @@ if [ -f "${oftree}" ]; then
global.bootm.oftree="$oftree"
fi
-nfsroot="${global.net.server}:/home/${global.user}/nfsroot/${global.hostname}"
+host ${global.net.server} nfsserver
+if [ $? != 0 ]; then
+ echo "Cannot resolve \"${global.net.server}\""
+ exit 1
+fi
+
+nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}"
ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip
--
2.19.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2019-01-07 7:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 7:39 [PATCH 0/9] net: Allow global.net.server being a hostname Sascha Hauer
2019-01-07 7:40 ` [PATCH 1/9] net: ip_route_get: Fix error message Sascha Hauer
2019-01-07 7:40 ` [PATCH 2/9] net: ip_route_get: Hook help text to command Sascha Hauer
2019-01-07 7:40 ` [PATCH 3/9] net: dns: leave host command with error on failure Sascha Hauer
2019-01-07 7:40 ` [PATCH 4/9] net: dns: Allow to set variable with the resolved host Sascha Hauer
2019-01-07 7:40 ` [PATCH 5/9] defaultenv: Pass serverip to nfsroot string Sascha Hauer
2019-01-07 7:40 ` [PATCH 6/9] net: Allow hostnames for global.net.server Sascha Hauer
2019-01-07 7:40 ` [PATCH 7/9] net: ip_route_get: resolv hostnames Sascha Hauer
2019-01-07 7:40 ` [PATCH 8/9] defaultenv: defaultenv uses ip_route_get Sascha Hauer
2019-01-07 7:40 ` Sascha Hauer [this message]
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=20190107074008.3797-10-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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