[PATCH 9/9] defaultenv: resolve global.net.server before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



global.net.server may contain a hostname, so we have to resolve it
before using it.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux