Add sysroot.bootloader repo config key
The sysroot.bootloader key configures the bootloader that OSTree uses when deploying a sysroot. Having this key allows specifying behavior not to use the default bootloader backend code, which is preferable when creating a first deployment from the sysroot (#1774). As of now, the key can take the values "auto" or "none". If the key is not given, the value defaults to "auto". "auto" causes _ostree_sysroot_query_bootloader() to be used when writing a new deployment, which is the original behavior that dynamically detects which bootloader to use. "none" avoids querying the bootloader dynamically. The BLS config fragments are still written to sysroot/boot/loader/entries for use by higher-level software. More values can be supported in future to specify a single bootloader, different behavior for the bootloader code, or a list of bootloaders to try. Resolves: #1774 Closes: #1814 Approved by: jlebon
This commit is contained in:
1 parent
99cf13b225
commit
21ebc7d21e
8 files changed
+181
-18
No files matched your search
@@ -3113,6 +3113,32 @@ reload_remote_config (OstreeRepo *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
reload_sysroot_config (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
{ g_autofree char *bootloader = NULL;
|
||||
|
||||
if (!ot_keyfile_get_value_with_default_group_optional (self->config, "sysroot",
|
||||
"bootloader", "auto",
|
||||
&bootloader, error))
|
||||
return FALSE;
|
||||
|
||||
/* TODO: possibly later add support for specifying a generic bootloader
|
||||
* binary "x" in /usr/lib/ostree/bootloaders/x). See:
|
||||
* https://github.com/ostreedev/ostree/issues/1719
|
||||
* https://github.com/ostreedev/ostree/issues/1801
|
||||
*/
|
||||
if (!(g_str_equal (bootloader, "auto") || g_str_equal (bootloader, "none")))
|
||||
return glnx_throw (error, "Invalid bootloader configuration: '%s'", bootloader);
|
||||
|
||||
self->bootloader = g_steal_pointer (&bootloader);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_repo_reload_config:
|
||||
* @self: repo
|
||||
@@ -3131,6 +3157,8 @@ ostree_repo_reload_config (OstreeRepo *self,
|
||||
return FALSE;
|
||||
if (!reload_remote_config (self, cancellable, error))
|
||||
return FALSE;
|
||||
if (!reload_sysroot_config (self, cancellable, error))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -6064,3 +6092,21 @@ ostree_repo_get_default_repo_finders (OstreeRepo *self)
|
||||
|
||||
return (const gchar * const *)self->repo_finders;
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_repo_get_bootloader:
|
||||
* @self: an #OstreeRepo
|
||||
*
|
||||
* Get the bootloader configured. See the documentation for the
|
||||
* "sysroot.bootloader" config key.
|
||||
*
|
||||
* Returns: bootloader configuration for the sysroot
|
||||
* Since: 2019.2
|
||||
*/
|
||||
const gchar *
|
||||
ostree_repo_get_bootloader (OstreeRepo *self)
|
||||
{
|
||||
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
|
||||
|
||||
return self->bootloader;
|
||||
}
|
||||
Reference in new issue
Block a user