RFE: Add a hidden option to ostree admin kargs edit-in-place to
update all existing deployments in place Example: $ sudo ostree admin kargs edit-in-place --append-if-missing=rw See https://github.com/ostreedev/ostree/issues/2617 This will not add duplicate key, if there is `TESTARG=VAL1` in the kernel arguments, `--append-if-missing=TESTARG=VAL2` will be ignored.
This commit is contained in:
1 parent
b04c436bb9
commit
3bc59a5206
13 files changed
+338
No files matched your search
@@ -20,6 +20,10 @@
|
||||
- uncomment the include in Makefile-libostree.am
|
||||
*/
|
||||
|
||||
LIBOSTREE_2022.5 {
|
||||
global:
|
||||
ostree_kernel_args_append_if_missing;
|
||||
} LIBOSTREE_2022.4;
|
||||
|
||||
/* Stub section for the stable release *after* this development one; don't
|
||||
* edit this other than to update the year. This is just a copy/paste
|
||||
|
||||
@@ -804,3 +804,28 @@ ostree_kernel_args_get_last_value (OstreeKernelArgs *kargs, const char *key)
|
||||
const OstreeKernelArgsEntry *e = entries->pdata[entries->len-1];
|
||||
return _ostree_kernel_args_entry_get_value (e);
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_kernel_args_append_if_missing:
|
||||
* @kargs: a OstreeKernelArgs instance
|
||||
* @arg: key or key/value pair to be added
|
||||
*
|
||||
* Appends @arg which is in the form of key=value pair to the hash table kargs->table
|
||||
* (appends to the value list if key is not in the hash table)
|
||||
* and appends key to kargs->order if it is not in the hash table.
|
||||
*
|
||||
* Since: 2022.5
|
||||
**/
|
||||
void
|
||||
ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs,
|
||||
const char *arg)
|
||||
{
|
||||
g_autofree char *key = g_strdup (arg);
|
||||
split_keyeq (key);
|
||||
|
||||
// Don't insert a duplicate key.
|
||||
if (g_hash_table_contains (kargs->table, key))
|
||||
return;
|
||||
|
||||
ostree_kernel_args_append (kargs, arg);
|
||||
}
|
||||
@@ -130,4 +130,8 @@ char **ostree_kernel_args_to_strv (OstreeKernelArgs *kargs);
|
||||
_OSTREE_PUBLIC
|
||||
char *ostree_kernel_args_to_string (OstreeKernelArgs *kargs);
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
void ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs,
|
||||
const char *arg);
|
||||
|
||||
G_END_DECLS
|
||||
Reference in new issue
Block a user