[Libguestfs] [PATCH 2/4] sysprep: Add `Dconf_needs_update flag.

Richard W.M. Jones rjones at redhat.com
Thu Aug 16 17:34:24 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

If an operation returns this, then 'dconf update' will be run in the
guest (using firstboot).  This is useful for doing GNOME
configuration.
---
 sysprep/main.ml               |    7 +++++++
 sysprep/sysprep_operation.ml  |    2 +-
 sysprep/sysprep_operation.mli |    2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sysprep/main.ml b/sysprep/main.ml
index 0e8ea20..49c1df3 100644
--- a/sysprep/main.ml
+++ b/sysprep/main.ml
@@ -214,8 +214,10 @@ let do_sysprep () =
 
         (* Parse flags. *)
         let relabel = ref false in
+        let dconf_update = ref false in
         List.iter (function
         | `Created_files -> relabel := true
+        | `Dconf_needs_update -> dconf_update := true; relabel := true
         ) flags;
 
         (* SELinux relabel? *)
@@ -234,6 +236,11 @@ let do_sysprep () =
           | _ -> ()
         );
 
+        (* Run dconf update? *)
+        if !dconf_update then
+          Firstboot.add_firstboot_script g root "dconf-update"
+            "#!/bin/sh\ndconf update";
+
         (* Unmount everything in this guest. *)
         g#umount_all ();
 
diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
index 24b868c..e0b6ff8 100644
--- a/sysprep/sysprep_operation.ml
+++ b/sysprep/sysprep_operation.ml
@@ -22,7 +22,7 @@ open Printf
 
 open Sysprep_gettext.Gettext
 
-type flag = [ `Created_files ]
+type flag = [ `Created_files | `Dconf_needs_update ]
 
 type callback = Guestfs.guestfs -> string -> flag list
 
diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli
index 87a0b9a..6fd178e 100644
--- a/sysprep/sysprep_operation.mli
+++ b/sysprep/sysprep_operation.mli
@@ -18,7 +18,7 @@
 
 (** Structure used to describe sysprep operations. *)
 
-type flag = [ `Created_files ]
+type flag = [ `Created_files | `Dconf_needs_update ]
 
 type callback = Guestfs.guestfs -> string -> flag list
 
-- 
1.7.10.4




More information about the Libguestfs mailing list