[gnome-boxes] win: Use viostor in unattended installs if possible
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] win: Use viostor in unattended installs if possible
- Date: Thu, 30 Aug 2012 11:46:21 +0000 (UTC)
commit a4a0780c8e177de9111ba5c75842dfa7b5955986
Author: Christophe Fergeau <cfergeau redhat com>
Date: Fri May 25 18:27:35 2012 +0200
win: Use viostor in unattended installs if possible
An extra ISO with the additional drivers need to be available, and
Boxes needs to be able to locate it.
https://bugzilla.gnome.org/show_bug.cgi?id=679752
src/win7-installer.vala | 6 +++++
src/winxp-installer.vala | 53 ++++++++++++++++++++++++++++++++-------------
2 files changed, 43 insertions(+), 16 deletions(-)
---
diff --git a/src/win7-installer.vala b/src/win7-installer.vala
index 77127a3..de4cd35 100644
--- a/src/win7-installer.vala
+++ b/src/win7-installer.vala
@@ -13,6 +13,12 @@ private class Boxes.Win7Installer: WindowsInstaller {
}
}
+ public override bool supports_virtio_disk {
+ get {
+ return (extra_iso != null);
+ }
+ }
+
static construct {
try {
arch_regex = new Regex ("BOXES_CPU");
diff --git a/src/winxp-installer.vala b/src/winxp-installer.vala
index 8f4e2db..113e0fe 100644
--- a/src/winxp-installer.vala
+++ b/src/winxp-installer.vala
@@ -25,6 +25,14 @@ private class Boxes.WinXPInstaller: WindowsInstaller {
}
}
+ private bool has_viostor_drivers;
+
+ public override bool supports_virtio_disk {
+ get {
+ return has_viostor_drivers;
+ }
+ }
+
static construct {
try {
key_regex = new Regex ("BOXES_PRODUCT_KEY");
@@ -52,28 +60,41 @@ private class Boxes.WinXPInstaller: WindowsInstaller {
}
public override async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws GLib.Error {
+ bool have_viostor = false;
+ has_viostor_drivers = false;
+
yield base.prepare_for_installation (vm_name, cancellable);
if (extra_iso == null)
return;
- ISOExtractor extractor = new ISOExtractor (extra_iso);
-
- yield extractor.mount_media (cancellable);
-
- string driver_path = (os_media.architecture == "x86_64")?"preinst/winxp/amd64":"preinst/winxp/x86";
-
- GLib.FileEnumerator enumerator = yield extractor.enumerate_children (driver_path, cancellable);
- GLib.List<FileInfo> infos = yield enumerator.next_files_async (4, GLib.Priority.DEFAULT, cancellable);
- while (infos != null) {
- foreach (var info in infos) {
- string relative_path = Path.build_filename (driver_path, info.get_name ());
- string full_path = extractor.get_absolute_path (relative_path);
- var unattended_file = new UnattendedRawFile (this, full_path, info.get_name ());
- debug ("Copying %s from extra ISO to unattended floppy", relative_path);
- yield unattended_file.copy (cancellable);
+ try {
+ ISOExtractor extractor = new ISOExtractor (extra_iso);
+
+ yield extractor.mount_media (cancellable);
+
+ string driver_path = (os_media.architecture == "x86_64")?"preinst/winxp/amd64":"preinst/winxp/x86";
+
+ GLib.FileEnumerator enumerator = yield extractor.enumerate_children (driver_path, cancellable);
+ GLib.List<FileInfo> infos = yield enumerator.next_files_async (4, GLib.Priority.DEFAULT, cancellable);
+ while (infos != null) {
+ foreach (var info in infos) {
+ string relative_path = Path.build_filename (driver_path, info.get_name ());
+ string full_path = extractor.get_absolute_path (relative_path);
+ var unattended_file = new UnattendedRawFile (this, full_path, info.get_name ());
+ debug ("Copying %s from extra ISO to unattended floppy", relative_path);
+ yield unattended_file.copy (cancellable);
+ if (info.get_name () == "viostor.sys")
+ have_viostor = true;
+ }
+ infos = yield enumerator.next_files_async (4, GLib.Priority.DEFAULT, cancellable);
}
- infos = yield enumerator.next_files_async (4, GLib.Priority.DEFAULT, cancellable);
+
+ // If we arrived there with no exception, then everything is setup for
+ // the Windows installer to be able to use a virtio disk controller
+ has_viostor_drivers = have_viostor;
+ } catch (GLib.Error e) {
+ has_viostor_drivers = false;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]