mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] menu: export box state to menu_box_state when using a command
@ 2012-05-27 10:36 Jean-Christophe PLAGNIOL-VILLARD
  2012-06-01  6:33 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-05-27 10:36 UTC (permalink / raw)
  To: barebox

this will allow to have different action based on the box state in shell

as example
menu -e -a -m boot -c 'export test=${menu_box_state}' -R -b 1 -d "yes/no"

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/menu.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/common/menu.c b/common/menu.c
index 6c530b6..070170e 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -483,6 +483,11 @@ static void menu_action_command(struct menu *m, struct menu_entry *me)
 	int ret;
 	const char *s = getenv(e->command);
 
+	if (me->type == MENU_ENTRY_BOX)
+		export_env_ull("menu_box_state", me->box_state);
+	else
+		setenv("menu_box_state", "");
+
 	/* can be a command as boot */
 	if (!s)
 		s = e->command;
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-01  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-27 10:36 [PATCH 1/1] menu: export box state to menu_box_state when using a command Jean-Christophe PLAGNIOL-VILLARD
2012-06-01  6:33 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox