deploy: add --karg-none argument
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
This commit is contained in:
parent
62cb078973
commit
652d9dd98a
|
|
@ -40,6 +40,7 @@ static char **opt_kernel_argv_append;
|
||||||
static gboolean opt_kernel_proc_cmdline;
|
static gboolean opt_kernel_proc_cmdline;
|
||||||
static char *opt_osname;
|
static char *opt_osname;
|
||||||
static char *opt_origin_path;
|
static char *opt_origin_path;
|
||||||
|
static gboolean opt_kernel_arg_none;
|
||||||
|
|
||||||
/* ATTENTION:
|
/* ATTENTION:
|
||||||
* Please remember to update the bash-completion script (bash/ostree) and
|
* Please remember to update the bash-completion script (bash/ostree) and
|
||||||
|
|
@ -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-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", 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-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 }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -79,6 +81,12 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
|
||||||
return FALSE;
|
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];
|
const char *refspec = argv[1];
|
||||||
|
|
||||||
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
|
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
|
||||||
|
|
@ -130,7 +138,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
|
||||||
if (!_ostree_kernel_args_append_proc_cmdline (kargs, cancellable, error))
|
if (!_ostree_kernel_args_append_proc_cmdline (kargs, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if (merge_deployment)
|
else if (merge_deployment && !opt_kernel_arg_none)
|
||||||
{
|
{
|
||||||
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (merge_deployment);
|
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (merge_deployment);
|
||||||
g_auto(GStrv) previous_args = g_strsplit (ostree_bootconfig_parser_get (bootconfig, "options"), " ", -1);
|
g_auto(GStrv) previous_args = g_strsplit (ostree_bootconfig_parser_get (bootconfig, "options"), " ", -1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue