Skip to content

Commit

Permalink
upgrade: add experimental option to reset overrides
Browse files Browse the repository at this point in the history
experimental ex-reset-overrides option allows resetting overrides before upgrading

Signed-off-by: Rafael G. Ruiz <[email protected]>
  • Loading branch information
Razaloc committed Aug 16, 2021
1 parent e1861fe commit 1808734
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/app/rpmostree-builtin-upgrade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand All @@ -60,6 +61,7 @@ static GOptionEntry option_entries[] = {
{ "trigger-automatic-update-policy", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_automatic, "For automated use only; triggered by automatic timer", NULL },
{ "lock-finalization", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_lock_finalization, "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 }
};

Expand Down Expand Up @@ -174,6 +176,7 @@ rpmostree_builtin_upgrade (int argc,
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. */
Expand Down
6 changes: 3 additions & 3 deletions src/daemon/rpmostreed-transaction-types.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1342,8 +1342,8 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
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, error))
return FALSE;
Expand Down Expand Up @@ -1440,7 +1440,7 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
if (override_replace_local_pkgs)
{
g_autoptr(GPtrArray) pkgs = NULL;
if (!import_many_local_rpms (repo, override_replace_local_pkgs, &pkgs,
if (!import_many_local_rpms (repo, override_replace_local_pkgs, &pkgs,
cancellable, error))
return FALSE;

Expand Down

0 comments on commit 1808734

Please sign in to comment.