[PATCH 11/11] defenv-2: Do not overwrite previously existing global variables

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 27 02:47:42 EDT 2013


In case board code has already initialized global variables during
init do not overwrite them.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 defaultenv-2/base/bin/init | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init
index ca02ba6..996fea7 100644
--- a/defaultenv-2/base/bin/init
+++ b/defaultenv-2/base/bin/init
@@ -2,16 +2,23 @@
 
 export PATH=/env/bin
 
-global hostname=generic
-global user=none
-global autoboot_timeout=3
-global boot.default=net
-global allow_color=true
+global hostname
+global user
+global autoboot_timeout
+global boot.default
+global allow_color
 global linux.bootargs.base
 #linux.bootargs.dyn.* will be cleared at the beginning of boot
 global linux.bootargs.dyn.ip
 global linux.bootargs.dyn.root
-global editcmd=sedit
+global editcmd
+
+[ -z "${global.hostname}" ] && global.hostname=generic
+[ -z "${global.user}" ] && global.user=none
+[ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
+[ -z "${global.boot.default}" ] && global.boot.default=net
+[ -z "${global.allow_color}" ] && global.allow_color=true
+[ -z "${global.editcmd}" ] && global.editcmd=sedit
 
 [ -e /env/config-board ] && /env/config-board
 /env/config
-- 
1.8.4.rc3




More information about the barebox mailing list