[PATCH 6/7] defaultenv-2/ansi-colors: export color only if enable

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Tue Sep 11 06:19:26 EDT 2012


This will allow to do not check it everywhere

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 defaultenv-2/base/data/ansi-colors |    4 ++++
 defaultenv-2/menu/menu/mainmenu    |    4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/defaultenv-2/base/data/ansi-colors b/defaultenv-2/base/data/ansi-colors
index c71b6b7..6365329 100644
--- a/defaultenv-2/base/data/ansi-colors
+++ b/defaultenv-2/base/data/ansi-colors
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+if [ ${global.allow_color} != "true" ]; then
+	exit
+fi
+
 # Colors
 export RED='\e[1;31m'
 export BLUE='\e[1;34m'
diff --git a/defaultenv-2/menu/menu/mainmenu b/defaultenv-2/menu/menu/mainmenu
index d7b0033..5bd7027 100644
--- a/defaultenv-2/menu/menu/mainmenu
+++ b/defaultenv-2/menu/menu/mainmenu
@@ -3,9 +3,7 @@
 savepath=$PATH
 export menupath=$PATH:/env/menu
 
-if [ ${global.allow_color} = "true" ]; then
-	. /env/data/ansi-colors
-fi
+. /env/data/ansi-colors
 
 while true; do
 	export PATH=${menupath}
-- 
1.7.10.4




More information about the barebox mailing list