diff --git a/man/ostree-admin-deploy.xml b/man/ostree-admin-deploy.xml
index 8915ad2c0b..8be3390e61 100644
--- a/man/ostree-admin-deploy.xml
+++ b/man/ostree-admin-deploy.xml
@@ -144,6 +144,14 @@ License along with this library. If not, see .
Append kernel argument; useful with e.g. console= that can be used multiple times.
+
+
+ ="NAME=VALUE"
+
+
+ Delete kernel argument if exists, can be used multiple times.
+
+
diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c
index bfeb81d905..c0faaab908 100644
--- a/src/ostree/ot-admin-builtin-deploy.c
+++ b/src/ostree/ot-admin-builtin-deploy.c
@@ -41,7 +41,7 @@ static gboolean opt_no_prune;
static gboolean opt_no_merge;
static char **opt_kernel_argv;
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 char *opt_osname;
static char *opt_origin_path;
@@ -79,8 +79,8 @@ static GOptionEntry options[] = {
"NAME=VALUE" },
{ "karg-none", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_arg_none, "Do not import kernel arguments",
NULL },
- { "karg-delete", 0, 0, G_OPTION_ARG_STRING, &opt_kernel_argv_delete,
- "Delete kernel argument if exists", "NAME=VALUE" },
+ { "karg-delete", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv_delete,
+ "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 iniramfs file", "FILE" },
{ 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);
}
- 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;
}
diff --git a/tests/test-admin-deploy-karg.sh b/tests/test-admin-deploy-karg.sh
index 047ca63b6d..39fcdf3614 100755
--- a/tests/test-admin-deploy-karg.sh
+++ b/tests/test-admin-deploy-karg.sh
@@ -71,11 +71,9 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'option
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'
-${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'
-${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'
-${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'
echo "ok deploy --karg-delete"