From d93cab7cf7597bd519011f6f7a0b3b9bb2276707 Mon Sep 17 00:00:00 2001 From: "Rafael G. Ruiz" Date: Thu, 12 Aug 2021 20:35:47 +0200 Subject: [PATCH] upgrade: add experimental option to reset overrides experimental ex-reset-overrides option allows resetting overrides before upgrading Signed-off-by: Rafael G. Ruiz --- src/app/rpmostree-builtin-upgrade.cxx | 4 ++++ src/daemon/rpmostreed-transaction-types.cxx | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/rpmostree-builtin-upgrade.cxx b/src/app/rpmostree-builtin-upgrade.cxx index 6360cbcfc3..75580a2d59 100644 --- a/src/app/rpmostree-builtin-upgrade.cxx +++ b/src/app/rpmostree-builtin-upgrade.cxx @@ -43,6 +43,7 @@ static gboolean opt_download_only; static char *opt_automatic; static gboolean opt_lock_finalization; static gboolean opt_bypass_driver; +static gboolean opt_ex_reset_overrides; /* "check-diff" is deprecated, replaced by "preview" */ static GOptionEntry option_entries[] @@ -72,6 +73,8 @@ static GOptionEntry option_entries[] "Prevent automatic deployment finalization on shutdown", NULL }, { "bypass-driver", 0, 0, G_OPTION_ARG_NONE, &opt_bypass_driver, "Force an upgrade even if an updates driver is registered", NULL }, + { "ex-reset-overrides", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, + &opt_ex_reset_overrides, "Reset overrides before upgrade", NULL }, { NULL } }; gboolean @@ -171,6 +174,7 @@ rpmostree_builtin_upgrade (int argc, char **argv, RpmOstreeCommandInvocation *in g_variant_dict_insert (&dict, "download-only", "b", opt_download_only); g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization); g_variant_dict_insert (&dict, "initiating-command-line", "s", invocation->command_line); + g_variant_dict_insert (&dict, "ex-reset-overrides", "b", opt_ex_reset_overrides); g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict)); /* Use newer D-Bus API only if we have to. */ diff --git a/src/daemon/rpmostreed-transaction-types.cxx b/src/daemon/rpmostreed-transaction-types.cxx index 033a97a4bc..5a7321c8f2 100644 --- a/src/daemon/rpmostreed-transaction-types.cxx +++ b/src/daemon/rpmostreed-transaction-types.cxx @@ -1301,8 +1301,8 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca return FALSE; } } - - if (no_overrides) + const gboolean ex_reset_overrides = vardict_lookup_bool (self->options, "ex-reset-overrides", FALSE); + if (no_overrides || (is_upgrade && ex_reset_overrides)) { if (rpmostree_origin_remove_all_overrides (origin)) changed = TRUE;