diff options
-rw-r--r-- | discover/grub2/grub2.h | 2 | ||||
-rw-r--r-- | discover/grub2/parser-api.c | 2 | ||||
-rw-r--r-- | discover/grub2/script.c | 13 |
3 files changed, 16 insertions, 1 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h index 970c500..de74fa5 100644 --- a/discover/grub2/grub2.h +++ b/discover/grub2/grub2.h @@ -114,6 +114,8 @@ int statement_simple_execute(struct grub2_script *script, struct grub2_statement *statement); int statement_if_execute(struct grub2_script *script, struct grub2_statement *statement); +int statement_menuentry_execute(struct grub2_script *script, + struct grub2_statement *statement); struct grub2_script *create_script(void *ctx); diff --git a/discover/grub2/parser-api.c b/discover/grub2/parser-api.c index f8915a1..a316673 100644 --- a/discover/grub2/parser-api.c +++ b/discover/grub2/parser-api.c @@ -28,7 +28,7 @@ struct grub2_statement *create_statement_menuentry(struct grub2_parser *parser, struct grub2_statement_menuentry *stmt = talloc(parser, struct grub2_statement_menuentry); stmt->st.type = STMT_TYPE_MENUENTRY; - stmt->st.exec = NULL; + stmt->st.exec = statement_menuentry_execute; stmt->argv = argv; stmt->statements = stmts; return &stmt->st; diff --git a/discover/grub2/script.c b/discover/grub2/script.c index 5361394..568e250 100644 --- a/discover/grub2/script.c +++ b/discover/grub2/script.c @@ -10,6 +10,8 @@ container_of(stmt, struct grub2_statement_simple, st) #define to_stmt_if(stmt) \ container_of(stmt, struct grub2_statement_if, st) +#define to_stmt_menuentry(stmt) \ + container_of(stmt, struct grub2_statement_menuentry, st) struct env_entry { const char *name; @@ -119,6 +121,17 @@ int statement_if_execute(struct grub2_script *script, return rc; } +int statement_menuentry_execute(struct grub2_script *script, + struct grub2_statement *statement) +{ + struct grub2_statement_menuentry *st = to_stmt_menuentry(statement); + + process_expansions(script, st->argv); + statements_execute(script, st->statements); + + return 0; +} + static void init_env(struct grub2_script *script) { struct env_entry *env; |