summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-11-28 14:13:58 -0500
committerRyan Lortie <desrt@desrt.ca>2014-01-13 16:24:43 -0500
commit403060bdb9460782cc2e26c04f1b84ad6d8f5db4 (patch)
treeae96bcafddcdb1370dbcaa508f8ee162e5f8f62a /bin
parent30f0c326d5593b60044975b33d0a67e00f5d195f (diff)
downloaddconf-403060bdb9460782cc2e26c04f1b84ad6d8f5db4.tar.gz
dconf(1): add 'dconf compile' command
This allows manually compiling dconf databases outside of /etc. This is meant to be used from the build system of projects that want to install dconf databases (like gdm) to easily build the database in-tree. https://bugzilla.gnome.org/show_bug.cgi?id=672303
Diffstat (limited to 'bin')
-rw-r--r--bin/dconf-update.vala14
-rw-r--r--bin/dconf.vala15
2 files changed, 29 insertions, 0 deletions
diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala
index 8b73658..867ded1 100644
--- a/bin/dconf-update.vala
+++ b/bin/dconf-update.vala
@@ -232,6 +232,20 @@ void update_all (string dirname) throws GLib.Error {
}
}
+void dconf_compile (string[] args) throws GLib.Error {
+ if (args[2] == null || args[3] == null || args[4] != null) {
+ throw new OptionError.FAILED ("must give output file and .d dir");
+ }
+
+ try {
+ var table = read_directory (args[3]);
+ table.write_contents (args[2]);
+ } catch (Error e) {
+ printerr ("%s\n", e.message);
+ Process.exit (1);
+ }
+}
+
void dconf_update (string[] args) throws GLib.Error {
update_all ("/etc/dconf/db");
}
diff --git a/bin/dconf.vala b/bin/dconf.vala
index ea05f77..5c4ce4e 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -54,6 +54,11 @@ void show_help (bool requested, string? command) {
synopsis = " [-f] PATH ";
break;
+ case "compile":
+ description = "Compile a binary database from keyfiles";
+ synopsis = " OUTPUT KEYFILEDIR ";
+ break;
+
case "update":
description = "Update the system dconf databases";
synopsis = "";
@@ -91,6 +96,7 @@ Commands:
list List the contents of a dir
write Change the value of a key
reset Reset the value of a key or dir
+ compile Compile a binary database from keyfiles
update Update the system databases
watch Watch a path for changes
dump Dump an entire subpath to stdout
@@ -126,6 +132,14 @@ Use 'dconf help COMMAND' to get detailed help.
if (" VALUE " in synopsis) {
str.append (" VALUE The value to write (in GVariant format)\n");
}
+
+ if (" OUTPUT " in synopsis) {
+ str.append (" OUTPUT The filename of the (binary) output\n");
+ }
+
+ if (" KEYFILEDIR " in synopsis) {
+ str.append (" KEYFILEDIR The path to the .d directory containing keyfiles\n");
+ }
}
str.append ("\n");
@@ -287,6 +301,7 @@ int main (string[] args) {
CommandMapping ("list", dconf_list),
CommandMapping ("write", dconf_write),
CommandMapping ("reset", dconf_reset),
+ CommandMapping ("compile", dconf_compile),
CommandMapping ("update", dconf_update),
CommandMapping ("watch", dconf_watch),
CommandMapping ("dump", dconf_dump),