]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/script.c
discover/grub2: Add default prefix
[petitboot] / discover / grub2 / script.c
index 0cf21967450efb3fbdf22c76f901c1c312b4d9d1..75b8aaaae474fc6348215dea26d7e963f31e4562 100644 (file)
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <log/log.h>
 #include <types/types.h>
 #include <talloc/talloc.h>
 
@@ -34,6 +35,8 @@ struct grub2_symtab_entry {
        struct list_item        list;
 };
 
+static const char *default_prefix = "/boot/grub";
+
 static struct grub2_symtab_entry *script_lookup_function(
                struct grub2_script *script, const char *name)
 {
@@ -278,7 +281,7 @@ int statement_simple_execute(struct grub2_script *script,
 
        entry = script_lookup_function(script, st->argv->argv[0]);
        if (!entry) {
-               fprintf(stderr, "undefined function '%s'\n", st->argv->argv[0]);
+               pb_log("grub2: undefined function '%s'\n", st->argv->argv[0]);
                return 1;
        }
 
@@ -400,7 +403,7 @@ static void init_env(struct grub2_script *script)
 
        env = talloc(script, struct env_entry);
        env->name = talloc_strdup(env, "prefix");
-       env->value = talloc_strdup(env, "/");
+       env->value = talloc_strdup(env, default_prefix);
 
        list_add(&script->environment, &env->list);
 }