[gnome-boxes] unattended-installer: Improve need_user_input checks



commit 6bd264f70cbe27c062a3f97848269daeb13da6dc
Author: Fabiano FidĂȘncio <fidencio redhat com>
Date:   Thu Feb 7 16:27:26 2019 +0100

    unattended-installer: Improve need_user_input checks
    
    Although the current check for whether the user input is needed for VM
    creation is functional, it's far from being optimal.
    
    More than that, the concept of "need user input" is confusing as it's
    related, in the unattended-installer case, to showing to the users the
    page where they will select whether to perform a normal or express
    installation.
    
    With that in mind, let's do a proper check on the media and OS level to
    decide whether the option to provide the express installation should be
    displayed or not.
    
    Signed-off-by: Fabiano FidĂȘncio <fidencio redhat com>

 src/unattended-installer.vala | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 62f8c690..e5f93e3a 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -6,7 +6,30 @@
 private class Boxes.UnattendedInstaller: InstallerMedia {
     public override bool need_user_input_for_vm_creation {
         get {
-            return !live; // No setup required by live media (and unknown medias are not UnattendedInstaller 
instances)
+            // Whether the Express Install option should be displayed or not
+
+            if (live || !os_media.supports_installer_script ())
+                return false;
+
+            var filter = new Filter ();
+            filter.add_constraint (INSTALL_SCRIPT_PROP_PROFILE, INSTALL_SCRIPT_PROFILE_DESKTOP);
+
+            var install_scripts = os_media.get_install_script_list ();
+            if (install_scripts.get_length () > 0) {
+
+                install_scripts = (install_scripts as Osinfo.List).new_filtered (filter) as 
InstallScriptList;
+                if (install_scripts.get_length () > 0)
+                    return true;
+
+                return false;
+            }
+
+            install_scripts = os.get_install_script_list ();
+            install_scripts = (install_scripts as Osinfo.List).new_filtered (filter) as InstallScriptList;
+            if (install_scripts.get_length () > 0)
+                return true;
+
+            return false;
         }
     }
 


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