[gnome-boxes] express,fedora: Install from remote repo for <= F16



commit 9ed36c4a6cb9dd94549d36c3c44066a8cbdbe369
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Mar 20 03:04:21 2012 +0200

    express,fedora: Install from remote repo for <= F16
    
    Not sure if this is a good thing in general but this is the quickest
    solution to this bug I could come-up with:
    
    https://bugzilla.redhat.com/show_bug.cgi?id=804834
    
    One issue with this change is that it makes Fedora 16 (and older) express
    installation to require Internet access. On the bright side, we can now
    have spice-vdagent package installed automatically from the start.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672420

 data/fedora.ks            |    7 +++++--
 src/fedora-installer.vala |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/data/fedora.ks b/data/fedora.ks
index 4f23b91..666f32c 100644
--- a/data/fedora.ks
+++ b/data/fedora.ks
@@ -1,7 +1,7 @@
 install
 keyboard BOXES_KBD
 lang BOXES_LANG
-network --device eth0 --bootproto dhcp
+network --onboot yes --device eth0 --bootproto dhcp --noipv6 --activate
 rootpw BOXES_PASSWORD
 firewall --disabled
 authconfig --enableshadow --enablemd5
@@ -23,6 +23,8 @@ reboot
 
 user --name=BOXES_USERNAME --password=BOXES_PASSWORD
 
+BOXES_FEDORA_REPOS
+
 %packages
 @base
 @core
@@ -32,8 +34,9 @@ user --name=BOXES_USERNAME --password=BOXES_PASSWORD
 @graphical-internet
 @sound-and-video
 
-# QXL video driver
+# QXL video driver and SPICE vdagent
 xorg-x11-drv-qxl
+spice-vdagent
 
 %end
 
diff --git a/src/fedora-installer.vala b/src/fedora-installer.vala
index 357991f..6b6c094 100644
--- a/src/fedora-installer.vala
+++ b/src/fedora-installer.vala
@@ -10,6 +10,21 @@ private class Boxes.FedoraInstaller: UnattendedInstaller {
     private string kernel_path;
     private string initrd_path;
 
+    // F16 ships buggly QXL package and spice-vdagent package won't be shipped until F17 so we install from
+    // up2date remote repos for anything less than F17.
+    private bool use_remote_repos { get { return express_install && uint64.parse (os.version) < 17; } }
+
+    private static Regex repo_regex;
+
+    static construct {
+        try {
+            repo_regex = new Regex ("BOXES_FEDORA_REPOS");
+        } catch (RegexError error) {
+            // This just can't fail
+            assert_not_reached ();
+        }
+    }
+
     public FedoraInstaller.copy (InstallerMedia media) throws GLib.Error {
         var source_path = get_unattended_dir ("fedora.ks");
 
@@ -25,6 +40,23 @@ private class Boxes.FedoraInstaller: UnattendedInstaller {
         os.set_cmdline ("ks=hd:sdb:" + unattended_dest_name);
     }
 
+    public override void check_needed_info () throws UnattendedInstallerError.SETUP_INCOMPLETE {
+        base.check_needed_info ();
+
+        if (!use_remote_repos)
+            return;
+
+        try {
+            var client = new SocketClient ();
+            client.connect_to_host ("fedoraproject.org", 80);
+        } catch (GLib.Error error) {
+            // FIXME: Mark for translation after string freeze
+            var message = "Internet access required for express installation of Fedora 16 and older";
+
+            throw new UnattendedInstallerError.SETUP_INCOMPLETE (message);
+        }
+    }
+
     protected override async void prepare_direct_boot (Cancellable? cancellable) throws GLib.Error {
         if (!express_toggle.active)
             return;
@@ -55,6 +87,14 @@ private class Boxes.FedoraInstaller: UnattendedInstaller {
         }
     }
 
+    protected override string fill_unattended_data (string data) throws RegexError {
+        var str = base.fill_unattended_data (data);
+
+        var repos = (use_remote_repos) ? "repo --name=fedora\nrepo --name=updates" : "";
+
+        return repo_regex.replace (str, str.length, 0, repos);
+    }
+
     private async void normal_clean_up (Cancellable? cancellable) throws GLib.Error {
         if (!mounted)
             return;



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