[PATCH] discover/grub: Allow to choose a different BLS directory
Samuel Mendoza-Jonas
sam at mendozajonas.com
Wed Apr 4 16:17:28 AEST 2018
On Wed, 2018-03-28 at 14:24 +0200, Javier Martinez Canillas wrote:
> The default path to search for BootLoaderSpec configuration files is
> /loader/entries but in some setups a different directory may be used.
>
> So allow this to be chosen by using a blsdir GRUB environment variable.
>
> Signed-off-by: Javier Martinez Canillas <javierm at redhat.com>
Thanks, merged as d01dfd5.
>
> ---
>
> Hello,
>
> I noticed that missed support for this in my previous patch, and it's supported
> by our GRUB 2 so let's have it in Petitboot for consistency. It also makes the
> Petitboot implementation more flexible.
>
> Best regards,
> Javier
>
> discover/grub2/blscfg.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/discover/grub2/blscfg.c b/discover/grub2/blscfg.c
> index 0f69f7e29106..02ac621be061 100644
> --- a/discover/grub2/blscfg.c
> +++ b/discover/grub2/blscfg.c
> @@ -180,6 +180,7 @@ int builtin_blscfg(struct grub2_script *script,
> struct conf_context *conf;
> struct bls_state *state;
> char *buf, *filename;
> + const char *blsdir;
> int n, len, rc = -1;
>
> conf = talloc_zero(dc, struct conf_context);
> @@ -191,12 +192,16 @@ int builtin_blscfg(struct grub2_script *script,
> conf->process_pair = bls_process_pair;
> conf->finish = bls_finish;
>
> - n = parser_scandir(dc, BLS_DIR, &bls_entries, bls_filter, bls_sort);
> + blsdir = script_env_get(script, "blsdir");
> + if (!blsdir)
> + blsdir = BLS_DIR;
> +
> + n = parser_scandir(dc, blsdir, &bls_entries, bls_filter, bls_sort);
> if (n <= 0)
> goto err;
>
> while (n--) {
> - filename = talloc_asprintf(dc, BLS_DIR"/%s",
> + filename = talloc_asprintf(dc, "%s/%s", blsdir,
> bls_entries[n]->d_name);
> if (!filename)
> break;
More information about the Petitboot
mailing list