From 0254bc4f852e0b39cadc77f82b57d0571dbb3197 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Mon, 28 Oct 2019 19:26:09 +0100 Subject: [PATCH] admin/deploy: Add new CLI option to retain previous version Signed-off-by: Rafael Fonseca --- src/ostree/ot-admin-builtin-deploy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index 8156cc153c..b06822f344 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -35,6 +35,7 @@ static gboolean opt_retain; static gboolean opt_stage; static gboolean opt_retain_pending; static gboolean opt_retain_rollback; +static gboolean opt_retain_previous; static gboolean opt_not_as_default; static gboolean opt_no_prune; static gboolean opt_no_merge; @@ -55,6 +56,7 @@ static GOptionEntry options[] = { { "stage", 0, 0, G_OPTION_ARG_NONE, &opt_stage, "Complete deployment at OS shutdown", NULL }, { "retain-pending", 0, 0, G_OPTION_ARG_NONE, &opt_retain_pending, "Do not delete pending deployments", NULL }, { "retain-rollback", 0, 0, G_OPTION_ARG_NONE, &opt_retain_rollback, "Do not delete rollback deployments", NULL }, + { "retain-previous-version", 0, 0, G_OPTION_ARG_NONE, &opt_retain_previous, "Do not delete previous deployment", NULL }, { "not-as-default", 0, 0, G_OPTION_ARG_NONE, &opt_not_as_default, "Append rather than prepend new deployment", NULL }, { "karg-proc-cmdline", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_proc_cmdline, "Import current /proc/cmdline", NULL }, { "karg", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv, "Set kernel argument, like root=/dev/sda1; this overrides any earlier argument with the same name", "NAME=VALUE" }, @@ -195,6 +197,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat OstreeSysrootDeployTreeOpts opts = { .override_kernel_argv = kargs_strv, .overlay_initrds = overlay_initrd_chksums ? (char**)overlay_initrd_chksums->pdata : NULL, + .flags = opt_retain_previous ? OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PREVIOUS_VERSION : 0, }; g_autoptr(OstreeDeployment) new_deployment = NULL;