]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/script.c
discover/grub2: Add menuentry execution
[petitboot] / discover / grub2 / script.c
index 536139418d93b89457743bc35688bb03103e0fb6..568e2509b99bc372d094e91909573c2f174dba73 100644 (file)
@@ -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;