mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-05 13:18:17 +03:00
karg-delete: support multiple times
Fix https://github.com/ostreedev/ostree/pull/2612#issuecomment-1764412141
This commit is contained in:
parent
5d92407ba9
commit
003cb99c32
@ -41,7 +41,7 @@ static gboolean opt_no_prune;
|
|||||||
static gboolean opt_no_merge;
|
static gboolean opt_no_merge;
|
||||||
static char **opt_kernel_argv;
|
static char **opt_kernel_argv;
|
||||||
static char **opt_kernel_argv_append;
|
static char **opt_kernel_argv_append;
|
||||||
static char *opt_kernel_argv_delete;
|
static char **opt_kernel_argv_delete;
|
||||||
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;
|
||||||
@ -79,8 +79,8 @@ static GOptionEntry options[] = {
|
|||||||
"NAME=VALUE" },
|
"NAME=VALUE" },
|
||||||
{ "karg-none", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_arg_none, "Do not import kernel arguments",
|
{ "karg-none", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_arg_none, "Do not import kernel arguments",
|
||||||
NULL },
|
NULL },
|
||||||
{ "karg-delete", 0, 0, G_OPTION_ARG_STRING, &opt_kernel_argv_delete,
|
{ "karg-delete", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv_delete,
|
||||||
"Delete kernel argument if exists", "NAME=VALUE" },
|
"Delete kernel argument if exists, can be used multiple times", "NAME=VALUE" },
|
||||||
{ "overlay-initrd", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_overlay_initrds,
|
{ "overlay-initrd", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_overlay_initrds,
|
||||||
"Overlay iniramfs file", "FILE" },
|
"Overlay iniramfs file", "FILE" },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
@ -205,9 +205,10 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
|
|||||||
ostree_kernel_args_append_argv (kargs, opt_kernel_argv_append);
|
ostree_kernel_args_append_argv (kargs, opt_kernel_argv_append);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_kernel_argv_delete)
|
for (char **strviter = opt_kernel_argv_delete; strviter && *strviter; strviter++)
|
||||||
{
|
{
|
||||||
if (!ostree_kernel_args_delete (kargs, opt_kernel_argv_delete, error))
|
const char *arg = *strviter;
|
||||||
|
if (!ostree_kernel_args_delete_if_present (kargs, arg, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +71,9 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'option
|
|||||||
echo "ok deploy --karg-append"
|
echo "ok deploy --karg-append"
|
||||||
|
|
||||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet .*TESTARG=TESTVALUE .*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'
|
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet .*TESTARG=TESTVALUE .*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'
|
||||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete=TESTARG=TESTVALUE testos:testos/buildmain/x86_64-runtime
|
${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete=TESTARG=TESTVALUE --karg-delete=quiet --karg-delete=APPENDARG=VALAPPEND testos:testos/buildmain/x86_64-runtime
|
||||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE'
|
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete=quiet testos:testos/buildmain/x86_64-runtime
|
|
||||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet'
|
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet'
|
||||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete=APPENDARG=VALAPPEND testos:testos/buildmain/x86_64-runtime
|
|
||||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND'
|
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND'
|
||||||
|
|
||||||
echo "ok deploy --karg-delete"
|
echo "ok deploy --karg-delete"
|
||||||
|
Loading…
Reference in New Issue
Block a user