diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2017-02-14 15:56:14 +1100 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2017-08-15 13:03:22 +1000 |
commit | 9f191cc3c194ed51534c22e2dae15b2c08c8abc2 (patch) | |
tree | 63158b566e95e496f238864ea8f791101ed9100c /discover/pxe-parser.c | |
parent | 98b04aa42a4f1dc8e585f00d75c3b28d9e9aa2a9 (diff) | |
download | talos-petitboot-9f191cc3c194ed51534c22e2dae15b2c08c8abc2.tar.gz talos-petitboot-9f191cc3c194ed51534c22e2dae15b2c08c8abc2.zip |
discover/pxe-parser: Recognise plugin sources
Extend the pxe-parser to recognise 'PLUGIN' as well as the usual 'LABEL'
when parsing a config file. 'PLUGIN' will be used to specify an option
that provides the location of an installable pb-plugin file, named by
the 'TARBALL' label.
Since plugin options are discovered via the same mechanism as boot
options treat them the same as boot options and at the 'type' field to
the boot_option struct to differentiate between them.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover/pxe-parser.c')
-rw-r--r-- | discover/pxe-parser.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c index ff86722..aef43b8 100644 --- a/discover/pxe-parser.c +++ b/discover/pxe-parser.c @@ -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) |