diff options
author | Jonathan Lebon <jlebon@redhat.com> | 2015-12-24 11:54:54 -0500 |
---|---|---|
committer | Jonathan Lebon <jlebon@redhat.com> | 2015-12-24 12:41:22 -0500 |
commit | 5e7ed2dd8bdb501104d9d5f7960ba929afb05cc5 (patch) | |
tree | b60f85c8eb72197cc4915444ef72bb521380028b /src/ostree/ot-admin-instutil-builtin-grub2-generate.c | |
parent | 1f1bfbf711221168f1a3fc6e18cde2929c0ac1d7 (diff) | |
download | ostree-5e7ed2dd8bdb501104d9d5f7960ba929afb05cc5.tar.gz |
grub2_generate: load sysroot before using it
The logic for checking which bootversion to use tries to access
sysroot->bootversion if the user didn't specify an explicit bootversion
on the command-line nor through the env var. However, at that point, the
sysroot object is not yet initialized, so it will always return 0, even
when it's 1.
This would cause e.g. `grub2-mkconfig` to have no output for the BLS
entries whenever the entries were under `/boot/loader.1`.
Related: RHBZ1293986
Diffstat (limited to 'src/ostree/ot-admin-instutil-builtin-grub2-generate.c')
-rw-r--r-- | src/ostree/ot-admin-instutil-builtin-grub2-generate.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c index 9f31c67a..ee7fe702 100644 --- a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c +++ b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c @@ -52,6 +52,9 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, GCancellable *c &sysroot, cancellable, error)) goto out; + if (!ostree_sysroot_load (sysroot, cancellable, error)) + goto out; + if (argc >= 2) { bootversion = (guint) g_ascii_strtoull (argv[1], NULL, 10); @@ -72,9 +75,6 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, GCancellable *c g_assert (bootversion == 0 || bootversion == 1); } - if (!ostree_sysroot_load (sysroot, cancellable, error)) - goto out; - if (!ostree_cmd__private__()->ostree_generate_grub2_config (sysroot, bootversion, 1, cancellable, error)) goto out; |