Petitboot provides a method for a user to manually specify a
configuration file that should be retrieved. Petitboot also has a
global proxy configuration.
This patch aims to marry the two so that a custom configuration file
can specify that a specific proxy should be used to access one (or all)
of the options within it.
This makes custom configuration files more powerful as they can point
to files behind proxies without the user needing to also specify the
global proxy for that specific custom configuration file to work.
This adds parsing for a `proxy` option which will apply to all boot
items found after.
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
+ if (opt && opt->proxy) {
+ setenv("http_proxy", opt->proxy, 1);
+ setenv("https_proxy", opt->proxy, 1);
+ }
+
boot_task = talloc_zero(ctx, struct boot_task);
boot_task->dry_run = dry_run;
boot_task->status_fn = status_fn;
boot_task = talloc_zero(ctx, struct boot_task);
boot_task->dry_run = dry_run;
boot_task->status_fn = status_fn;
struct discover_device *device;
struct boot_option *option;
struct list_item list;
struct discover_device *device;
struct boot_option *option;
struct list_item list;
struct resource *boot_image;
struct resource *initrd;
struct resource *boot_image;
struct resource *initrd;
char **pxe_conf_files;
struct pb_url *pxe_base_url;
int current;
char **pxe_conf_files;
struct pb_url *pxe_base_url;
int current;
};
static void pxe_finish(struct conf_context *conf)
{
struct pxe_parser_info *info = conf->parser_info;
};
static void pxe_finish(struct conf_context *conf)
{
struct pxe_parser_info *info = conf->parser_info;
+ if (info->opt) {
+ if (info->proxy)
+ info->opt->proxy = talloc_strdup(info->opt, info->proxy);
discover_context_add_boot_option(conf->dc, info->opt);
discover_context_add_boot_option(conf->dc, info->opt);
}
/* We need a slightly modified version of pb_url_join, to allow for the
}
/* We need a slightly modified version of pb_url_join, to allow for the
+ if (streq(name, "PROXY")) {
+ if (parser_info->proxy)
+ talloc_free(parser_info->proxy);
+
+ parser_info->proxy = talloc_strdup(parser_info, value);
+ return;
+ }
+
if (streq(name, "LABEL") || streq(name, "PLUGIN")) {
if (opt)
pxe_finish(ctx);
if (streq(name, "LABEL") || streq(name, "PLUGIN")) {
if (opt)
pxe_finish(ctx);