discover/pxe-parser: Recognise plugin sources
[petitboot] / discover / pxe-parser.c
index ff867229e5fa9b32c238509a9f89dea9cb32ba53..aef43b8cdfc06737ad72d06fc7f76a4c1670473f 100644 (file)
@@ -148,7 +148,7 @@ static void pxe_process_pair(struct conf_context *ctx,
                return;
        }
 
-       if (streq(name, "LABEL")) {
+       if (streq(name, "LABEL") || streq(name, "PLUGIN")) {
                if (opt)
                        pxe_finish(ctx);
 
@@ -158,8 +158,12 @@ static void pxe_process_pair(struct conf_context *ctx,
                opt->option->id = talloc_asprintf(opt, "%s@%p",
                                ctx->dc->device->device->id, opt);
 
-               opt->option->is_default = parser_info->default_name &&
-                                       streq(parser_info->default_name, value);
+               if (streq(name, "LABEL")) {
+                       opt->option->type = DISCOVER_BOOT_OPTION;
+                       opt->option->is_default = parser_info->default_name &&
+                                               streq(parser_info->default_name, value);
+               } else
+                       opt->option->type = DISCOVER_PLUGIN_OPTION;
 
                parser_info->opt = opt;
                return;
@@ -169,6 +173,14 @@ static void pxe_process_pair(struct conf_context *ctx,
        if (!opt)
                return;
 
+       if (streq(name, "TARBALL") &&
+                       opt->option->type == DISCOVER_PLUGIN_OPTION) {
+               url = pxe_url_join(ctx->dc, ctx->dc->conf_url, value);
+               opt->boot_image = create_url_resource(opt, url);
+               /* All other options apply to boot options only */
+               return;
+       }
+
        if (streq(name, "KERNEL")) {
                url = pxe_url_join(ctx->dc, ctx->dc->conf_url, value);
                opt->boot_image = create_url_resource(opt, url);
@@ -210,7 +222,6 @@ static void pxe_process_pair(struct conf_context *ctx,
                url = pxe_url_join(ctx->dc, ctx->dc->conf_url, value);
                opt->dtb = create_url_resource(opt, url);
        }
-
 }
 
 static void pxe_load_next_filename(struct conf_context *conf)