[gnome-boxes] unattended-installer: Remove a hard-coded rule



commit 52d648b43f3e36230cc3e614a9eddda8d3d12176
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Oct 13 18:46:38 2014 +0100

    unattended-installer: Remove a hard-coded rule
    
    Instead of checking if distro of OS is "win", lets instead check which
    installation method we are using.

 src/unattended-installer.vala |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 2f06e03..7d9b401 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -53,6 +53,17 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
 
     private static Fdo.Accounts? accounts;
 
+    private InstallScriptInjectionMethod injection_method {
+        private get {
+            foreach (var unattended_file in unattended_files) {
+                if (unattended_file is UnattendedScriptFile)
+                    return (unattended_file as UnattendedScriptFile).injection_method;
+            }
+
+            return InstallScriptInjectionMethod.DISK;
+        }
+    }
+
     private static string escape_mkisofs_path (string path) {
         var str = path.replace ("\\", "\\\\");
 
@@ -338,8 +349,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         disk.set_driver_format (DomainDiskFormat.RAW);
         disk.set_source (disk_file.get_path ());
 
-        // FIXME: Ideally, we shouldn't need to check for distro
-        if (os.distro == "win") {
+        if (injection_method == InstallScriptInjectionMethod.FLOPPY) {
             disk.set_target_dev ((path_format == PathFormat.DOS)? "A" : "fd");
             disk.set_guest_device_type (DomainDiskGuestDeviceType.FLOPPY);
             disk.set_target_bus (DomainDiskBus.FDC);


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