[gnome-boxes] unattended-file: Prefer initrd over disk as injection method



commit 9b4e202cf9e242b4d6de6b548dd03af19769e26f
Author: Fabiano FidĂȘncio <fidencio redhat com>
Date:   Mon Jun 10 09:49:12 2019 +0200

    unattended-file: Prefer initrd over disk as injection method
    
    Let's prefer "initrd" over "disk" injection method as *all* linuxes
    install scripts supported by osinfo-db do support initrd as the
    injection method.
    
    By doing this we can ensure the same code path will be executed for all
    linuxes unattended installs, decreasing maintenance and allowing us to
    even drop the bits specifically used by disk (if we wish to do so).
    
    Signed-off-by: Fabiano FidĂȘncio <fidencio redhat com>

 src/unattended-file.vala      | 6 +++---
 src/unattended-installer.vala | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/unattended-file.vala b/src/unattended-file.vala
index 9ae6ab94..3c9ca8cc 100644
--- a/src/unattended-file.vala
+++ b/src/unattended-file.vala
@@ -119,12 +119,12 @@ public UnattendedScriptFile (UnattendedInstaller installer,
         this.dest_name = dest_name;
 
         var injection_methods = script.get_injection_methods ();
-        if (InstallScriptInjectionMethod.DISK in injection_methods)
+        if (InstallScriptInjectionMethod.INITRD in injection_methods)
+            injection_method = InstallScriptInjectionMethod.INITRD;
+        else if (InstallScriptInjectionMethod.DISK in injection_methods)
             injection_method = InstallScriptInjectionMethod.DISK;
         else if (InstallScriptInjectionMethod.FLOPPY in injection_methods)
             injection_method = InstallScriptInjectionMethod.FLOPPY;
-        else if (InstallScriptInjectionMethod.INITRD in injection_methods)
-            injection_method = InstallScriptInjectionMethod.INITRD;
         else
             throw new GLib.IOError.NOT_SUPPORTED ("No supported injection method available.");
     }
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 69638504..9a0b8ea1 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -265,6 +265,13 @@ public void configure_install_script (InstallScript script) {
         config.set_hostname (hostname);
         config.set_hardware_arch (os_media.architecture);
 
+        // The default preferred injection method, due to historical reasons,
+        // is "disk". That's the reason we have to explicitly set the preferred
+        // injection method to whatever we decide to use.
+        // Explicitly setting it every time helps us to not forget this or that
+        // case and is not that costly in the end.
+        script.set_preferred_injection_method (injection_method);
+
         if (avatar_file != null) {
             var location = ((script.path_format == PathFormat.UNIX)? "/" : "\\") + avatar_file.dest_name;
             config.set_avatar_location (location);


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