#include "ostree-repo-private.h"
#include "ostree-sysroot-private.h"
#include "ostree-sepolicy-private.h"
-#include "ostree-bootloader-zipl.h"
#include "ostree-deployment-private.h"
#include "ostree-core-private.h"
#include "ostree-linuxfsutil.h"
gboolean bootloader_is_atomic = FALSE;
SyncStats syncstats = { 0, };
g_autoptr(OstreeBootloader) bootloader = NULL;
- const char *bootloader_config = NULL;
if (!requires_new_bootversion)
{
if (!create_new_bootlinks (self, self->bootversion,
return glnx_throw_errno_prefix (error, "Remounting /boot read-write");
}
- OstreeRepo *repo = ostree_sysroot_repo (self);
-
- bootloader_config = ostree_repo_get_bootloader (repo);
-
- g_debug ("Using bootloader configuration: %s", bootloader_config);
-
- if (g_str_equal (bootloader_config, "auto"))
- {
- if (!_ostree_sysroot_query_bootloader (self, &bootloader, cancellable, error))
- return FALSE;
- }
- else if (g_str_equal (bootloader_config, "none"))
- {
- /* No bootloader specified; do not query bootloaders to run. */
- }
- else if (g_str_equal (bootloader_config, "zipl"))
- {
- /* Because we do not mark zipl as active by default, lets creating one here,
- * which is basically the same what _ostree_sysroot_query_bootloader() does
- * for other bootloaders if being activated.
- * */
- bootloader = (OstreeBootloader*) _ostree_bootloader_zipl_new (self);
- }
+ if (!_ostree_sysroot_query_bootloader (self, &bootloader, cancellable, error))
+ return FALSE;
bootloader_is_atomic = bootloader != NULL && _ostree_bootloader_is_atomic (bootloader);
(bootloader_is_atomic ? "Transaction complete" : "Bootloader updated"),
requires_new_bootversion ? "yes" : "no",
new_deployments->len - self->deployments->len);
+ const gchar *bootloader_config = ostree_repo_get_bootloader (ostree_sysroot_repo (self));
ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_DEPLOYMENT_COMPLETE_ID),
"MESSAGE=%s", msg,
"OSTREE_BOOTLOADER=%s", bootloader ? _ostree_bootloader_get_name (bootloader) : "none",
#include "ostree-bootloader-uboot.h"
#include "ostree-bootloader-syslinux.h"
#include "ostree-bootloader-grub2.h"
+#include "ostree-bootloader-zipl.h"
/**
* SECTION:ostree-sysroot
* ostree_sysroot_query_bootloader:
* @sysroot: Sysroot
* @out_bootloader: (out) (transfer full) (allow-none): Return location for bootloader, may be %NULL
+ * @out_bootloader_config: (out) (transfer none) (allow-none): Return location for value of ostree repo config variable sysroot.bootloader, may be %NULL
* @cancellable: Cancellable
* @error: Error
*/
GCancellable *cancellable,
GError **error)
{
- gboolean is_active;
- g_autoptr(OstreeBootloader) ret_loader =
- (OstreeBootloader*)_ostree_bootloader_syslinux_new (sysroot);
- if (!_ostree_bootloader_query (ret_loader, &is_active,
- cancellable, error))
- return FALSE;
+ OstreeRepo *repo = ostree_sysroot_repo (sysroot);
+ g_autofree gchar *bootloader_config = ostree_repo_get_bootloader (repo);
+
+ g_debug ("Using bootloader configuration: %s", bootloader_config);
- if (!is_active)
+ g_autoptr(OstreeBootloader) ret_loader = NULL;
+ if (g_str_equal (bootloader_config, "none"))
{
- g_object_unref (ret_loader);
- ret_loader = (OstreeBootloader*)_ostree_bootloader_grub2_new (sysroot);
- if (!_ostree_bootloader_query (ret_loader, &is_active,
- cancellable, error))
- return FALSE;
+ /* No bootloader specified; do not query bootloaders to run. */
+ ret_loader = NULL;
}
- if (!is_active)
+ else if (g_str_equal (bootloader_config, "zipl"))
{
- g_object_unref (ret_loader);
- ret_loader = (OstreeBootloader*)_ostree_bootloader_uboot_new (sysroot);
- if (!_ostree_bootloader_query (ret_loader, &is_active, cancellable, error))
+ /* We never consider zipl as active by default, so it can only be created
+ * if it's explicitly requested in the config */
+ ret_loader = (OstreeBootloader*) _ostree_bootloader_zipl_new (sysroot);
+ }
+ else if (g_str_equal (bootloader_config, "auto"))
+ {
+ gboolean is_active;
+ ret_loader = (OstreeBootloader*)_ostree_bootloader_syslinux_new (sysroot);
+ if (!_ostree_bootloader_query (ret_loader, &is_active,
+ cancellable, error))
return FALSE;
+
+ if (!is_active)
+ {
+ g_object_unref (ret_loader);
+ ret_loader = (OstreeBootloader*)_ostree_bootloader_grub2_new (sysroot);
+ if (!_ostree_bootloader_query (ret_loader, &is_active,
+ cancellable, error))
+ return FALSE;
+ }
+ if (!is_active)
+ {
+ g_object_unref (ret_loader);
+ ret_loader = (OstreeBootloader*)_ostree_bootloader_uboot_new (sysroot);
+ if (!_ostree_bootloader_query (ret_loader, &is_active, cancellable, error))
+ return FALSE;
+ }
+ if (!is_active)
+ g_clear_object (&ret_loader);
}
- if (!is_active)
- g_clear_object (&ret_loader);
+ else
+ g_assert_not_reached ();
ot_transfer_out_value(out_bootloader, &ret_loader);
return TRUE;