[gnome-boxes] installer: Insert extra iso if available



commit 7b359a1cdf898b360081e8092cc7de785d8470fc
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Apr 23 17:24:07 2012 +0200

    installer: Insert extra iso if available
    
    This iso will be used during automatic Windows installations. It
    contains the viostor driver to be able to use virtio at install time
    and extra drivers (vioserial, ...) and utilities (vdagent) which are
    added to the install after it's done. This improves VM integration
    a lot.
    The name of the iso is win-tools.iso, and it's currently looked up
    in $XDG_CACHE_HOME/gnome-boxes/ first, and if not found, it's
    searched in $datadir/gnome-boxes/unattended.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679752

 src/unattended-installer.vala |   28 ++++++++++++++++++++++++++++
 src/win7-installer.vala       |    3 +++
 src/windows-installer.vala    |    6 ++++++
 src/winxp-installer.vala      |    3 +++
 4 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 08cfe7c..4e6583d 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -47,6 +47,12 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
     public DataStreamNewlineType newline_type;
     public File? disk_file;
 
+    private string _extra_iso;
+    protected string extra_iso {
+        owned get { return lookup_extra_iso (_extra_iso); }
+        set { _extra_iso = value; }
+    }
+
     protected GLib.List<UnattendedFile> unattended_files;
 
     protected Gtk.Table setup_table;
@@ -157,6 +163,14 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         domain.add_device (disk);
     }
 
+    // Allows us to add an extra install media, for example with more windows drivers
+    public void add_extra_iso (Domain domain) {
+        if (extra_iso == null)
+            return;
+
+        add_cd_config (domain, DomainDiskType.FILE, extra_iso, "hdd", false);
+    }
+
     public override void populate_setup_vbox (Gtk.VBox setup_vbox) {
         foreach (var child in setup_vbox.get_children ())
             setup_vbox.remove (child);
@@ -322,6 +336,20 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         debug ("Floppy image for unattended installation created at '%s'", disk_path);
     }
 
+    private string? lookup_extra_iso (string name)
+    {
+        var path = get_user_pkgcache (name);
+
+        if (FileUtils.test (path, FileTest.IS_REGULAR))
+            return path;
+
+        path = get_unattended (name);
+        if (FileUtils.test (path, FileTest.IS_REGULAR))
+            return path;
+
+        return null;
+    }
+
     private async void fetch_user_avatar (Gtk.Image avatar) {
         if (accounts == null)
             return;
diff --git a/src/win7-installer.vala b/src/win7-installer.vala
index 7722a5c..77127a3 100644
--- a/src/win7-installer.vala
+++ b/src/win7-installer.vala
@@ -1,5 +1,7 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 
+using GVirConfig;
+
 // Automated installer media for Windows 7 and 2008
 
 private class Boxes.Win7Installer: WindowsInstaller {
@@ -51,5 +53,6 @@ private class Boxes.Win7Installer: WindowsInstaller {
             critical ("'%s' is longer than 15 characters, expect %s express installation to fail!",
                       os.short_id,
                       os.name);
+        extra_iso = "win-tools.iso";
     }
 }
diff --git a/src/windows-installer.vala b/src/windows-installer.vala
index c35522c..f8b5dfc 100644
--- a/src/windows-installer.vala
+++ b/src/windows-installer.vala
@@ -14,4 +14,10 @@ private abstract class Boxes.WindowsInstaller: UnattendedInstaller {
 
         return disk;
     }
+
+    public override void setup_domain_config (Domain domain) {
+        base.setup_domain_config (domain);
+        if (extra_iso != null)
+            add_extra_iso (domain);
+    }
 }
diff --git a/src/winxp-installer.vala b/src/winxp-installer.vala
index 4ff19cf..da5bc1d 100644
--- a/src/winxp-installer.vala
+++ b/src/winxp-installer.vala
@@ -1,5 +1,7 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 
+using GVirConfig;
+
 // Automated installer media for Windows XP, 2000 and 2003
 private class Boxes.WinXPInstaller: WindowsInstaller {
     private const uint[] allowed_dash_positions = { 5, 11, 17, 23 };
@@ -46,6 +48,7 @@ private class Boxes.WinXPInstaller: WindowsInstaller {
         unattended_source = get_unattended (name);
         add_unattended_file (new UnattendedTextFile (this, unattended_source, name));
         newline_type = DataStreamNewlineType.CR_LF;
+        extra_iso = "win-tools.iso";
     }
 
     protected override void setup_ui () {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]