ostree admin instutil set-kargs: make more flexible

Add command line arguments:
 --import-proc-cmdline: import values from /proc/cmdline
 --merge: import current values
 --replace=ARG=VALUE: replace value
 --append=ARG=VALUE: append a new argument

Extra command line arguments are treated like --append=, which
gives backwards compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
This commit is contained in:
Owen W. Taylor committed 2014-09-26 10:40:37 -04:00
1 parent edf9cf5a7f
commit 262cba09c0
5 files changed
+84 -24

No files matched your search

+24
View File
@@ -21,6 +21,7 @@
#include "config.h"
#include "ostree-kernel-args.h"
#include "libgsystem.h"
#include <string.h>
@@ -156,6 +157,29 @@ _ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
}
}
gboolean
_ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
GCancellable *cancellable,
GError **error)
{
gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
gs_free char *proc_cmdline = NULL;
gsize proc_cmdline_len = 0;
gs_strfreev char **proc_cmdline_args = NULL;
if (!g_file_load_contents (proc_cmdline_path, cancellable,
&proc_cmdline, &proc_cmdline_len,
NULL, error))
return FALSE;
g_strchomp (proc_cmdline);
proc_cmdline_args = g_strsplit (proc_cmdline, " ", -1);
_ostree_kernel_args_append_argv (kargs, proc_cmdline_args);
return TRUE;
}
void
_ostree_kernel_args_parse_append (OstreeKernelArgs *kargs,
const char *options)
+4
View File
@@ -40,6 +40,10 @@ void _ostree_kernel_args_append (OstreeKernelArgs *kargs,
void _ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
char **argv);
gboolean _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
GCancellable *cancellable,
GError **error);
void _ostree_kernel_args_parse_append (OstreeKernelArgs *kargs,
const char *options);