Skip to content

Commit

Permalink
deploy: add --karg-none argument
Browse files Browse the repository at this point in the history
If the current deployment has "rootwait root=/dev/sda2",
but the new deployment does not need "rootwait" anymore,
there is no way to clear this arg at the moment (as opposed
to "karg=root=", which overrides any earlier argument with
the same name). With "--karg-none" users can now clear all
the previous args and set new "root=":

ostree admin deploy --karg-none --karg=root=LABEL=rootfs

Closes: #1401
Approved by: cgwalters
  • Loading branch information
gatispaeglis authored and rh-atomic-bot committed Jan 10, 2018
1 parent 62cb078 commit 652d9dd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ostree/ot-admin-builtin-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static char **opt_kernel_argv_append;
static gboolean opt_kernel_proc_cmdline;
static char *opt_osname;
static char *opt_origin_path;
static gboolean opt_kernel_arg_none;

/* ATTENTION:
* Please remember to update the bash-completion script (bash/ostree) and
Expand All @@ -56,6 +57,7 @@ static GOptionEntry options[] = {
{ "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" },
{ "karg-append", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv_append, "Append kernel argument; useful with e.g. console= that can be used multiple times", "NAME=VALUE" },
{ "karg-none", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_arg_none, "Do not import kernel arguments", NULL },
{ NULL }
};

Expand All @@ -79,6 +81,12 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
return FALSE;
}

if (opt_kernel_proc_cmdline && opt_kernel_arg_none)
{
ot_util_usage_error (context, "Can't specify both --karg-proc-cmdline and --karg-none", error);
return FALSE;
}

const char *refspec = argv[1];

OstreeRepo *repo = ostree_sysroot_repo (sysroot);
Expand Down Expand Up @@ -130,7 +138,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
if (!_ostree_kernel_args_append_proc_cmdline (kargs, cancellable, error))
return FALSE;
}
else if (merge_deployment)
else if (merge_deployment && !opt_kernel_arg_none)
{
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (merge_deployment);
g_auto(GStrv) previous_args = g_strsplit (ostree_bootconfig_parser_get (bootconfig, "options"), " ", -1);
Expand Down

0 comments on commit 652d9dd

Please sign in to comment.