[gnome-boxes] installer: Remove CDROM from config after installation
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] installer: Remove CDROM from config after installation
- Date: Fri, 21 Dec 2012 16:11:33 +0000 (UTC)
commit e52fcad71b74884be907fb0daa517e88b34a83d8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Dec 20 03:53:52 2012 +0200
installer: Remove CDROM from config after installation
Remove CDROM disk from domain configuration after installation is
complete.
https://bugzilla.gnome.org/show_bug.cgi?id=690536
src/installer-media.vala | 22 +++++++++++++++++++++-
src/unattended-installer.vala | 16 ++--------------
2 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index f44e7ee..a2ffb59 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -78,7 +78,10 @@ private class Boxes.InstallerMedia : GLib.Object {
add_cd_config (domain, from_image? DomainDiskType.FILE : DomainDiskType.BLOCK, device_file, "hdc", true);
}
- public virtual void setup_post_install_domain_config (Domain domain) {}
+ public virtual void setup_post_install_domain_config (Domain domain) {
+ if (!live)
+ remove_disk_from_domain_config (domain, device_file);
+ }
public virtual void populate_setup_vbox (Gtk.VBox setup_vbox) {}
@@ -118,6 +121,23 @@ private class Boxes.InstallerMedia : GLib.Object {
domain.add_device (disk);
}
+ protected void remove_disk_from_domain_config (Domain domain, string disk_path) {
+ var devices = domain.get_devices ();
+ foreach (var device in devices) {
+ if (!(device is DomainDisk))
+ continue;
+
+ var disk = device as DomainDisk;
+ if (disk.get_source () == disk_path) {
+ devices.remove (device);
+
+ break;
+ }
+ }
+
+ domain.set_devices (devices);
+ }
+
private async GUdev.Device? get_device_from_path (string path, Client client, Cancellable? cancellable) {
try {
var mount_dir = File.new_for_commandline_arg (path);
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 5fe9111..9439efb 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -227,20 +227,8 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
public override void setup_post_install_domain_config (Domain domain) {
base.setup_post_install_domain_config (domain);
- var devices = domain.get_devices ();
- foreach (var device in devices) {
- if (!(device is DomainDisk))
- continue;
-
- var disk = device as DomainDisk;
- if (disk.get_source () == disk_file.get_path ()) {
- devices.remove (device);
-
- break;
- }
- }
-
- domain.set_devices (devices);
+ var path = disk_file.get_path ();
+ remove_disk_from_domain_config (domain, path);
}
public override void populate_setup_vbox (Gtk.VBox setup_vbox) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]