summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javierm@redhat.com>2018-03-28 14:24:43 +0200
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-03-29 13:14:22 +1100
commitd01dfd5a6ca8283939265875dc69d665f955aba2 (patch)
tree2733342865c3356e7ecd2ed5710ea175a9c1bfa6
parentd09e1761f51f3cba8ca6190380f4a312948d8f4c (diff)
downloadtalos-petitboot-d01dfd5a6ca8283939265875dc69d665f955aba2.zip
talos-petitboot-d01dfd5a6ca8283939265875dc69d665f955aba2.tar.gz
discover/grub: Allow to choose a different BLS directory
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@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--discover/grub2/blscfg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/discover/grub2/blscfg.c b/discover/grub2/blscfg.c
index 0f69f7e..02ac621 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;
OpenPOWER on IntegriCloud