[PATCH 2/2 rhel5-branch f14-branch master] Add noeject support to cdrom eject handling (#477887)

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

 



Resolves: rhbz#477887
---
 anaconda |    8 +++++++-
 image.py |   18 ++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/anaconda b/anaconda
index 2277795..106928b 100755
--- a/anaconda
+++ b/anaconda
@@ -241,6 +241,8 @@ def parseOptions():
     op.add_option("--noiscsi", dest="iscsi", action="store_false", default=False)
     op.add_option("--iscsi", action="store_true")
 
+    op.add_option("--noeject", action="store_true", default=False)
+
     # Miscellaneous
     op.add_option("--module", action="append", default=[])
     op.add_option("--nomount", dest="rescue_nomount", action="store_true", default=False)
@@ -482,6 +484,7 @@ class Anaconda:
         self.updateSrc = None
         self.canReIPL = False
         self.reIPLMessage = None
+        self.noeject = False
 
     def setDispatch(self):
         self.dispatch = dispatch.Dispatcher(self)
@@ -522,7 +525,7 @@ class Anaconda:
     def setMethod(self):
         if self.methodstr.startswith('cdrom://'):
             from image import CdromInstallMethod
-            self.method =  CdromInstallMethod(self.methodstr, self.rootPath, self.intf)
+            self.method =  CdromInstallMethod(self.methodstr, self.rootPath, self.intf, self.noeject)
         elif self.methodstr.startswith('nfs:/'):
             from image import NfsInstallMethod
             self.method =  NfsInstallMethod(self.methodstr, self.rootPath, self.intf)
@@ -669,6 +672,9 @@ if __name__ == "__main__":
     if opts.virtpconsole:
         flags.virtpconsole = opts.virtpconsole
 
+    if opts.noeject:
+        anaconda.noeject = True
+
     # probing for hardware on an s390 seems silly...
     if rhpl.getArch() == "s390":
         opts.isHeadless = True
diff --git a/image.py b/image.py
index ab689a8..dcdeca5 100644
--- a/image.py
+++ b/image.py
@@ -140,7 +140,10 @@ class CdromInstallMethod(ImageInstallMethod):
                                    % ("/mnt/source",))
 
     def ejectCD(self):
-        isys.ejectCdrom(self.device, makeDevice=1)
+        if self.noeject:
+            log.info("noeject in effect, not ejecting cdrom")
+        else:
+            isys.ejectCdrom(self.device, makeDevice=1)
 
     def badPackageError(self, pkgname):
         return _("The file %s cannot be opened.  This is due to a missing "
@@ -257,7 +260,10 @@ class CdromInstallMethod(ImageInstallMethod):
                 break
 
         if not done:
-            isys.ejectCdrom(self.device)
+            if self.noeject:
+                log.info("noeject in effect, not ejecting cdrom")
+            else:
+                isys.ejectCdrom(self.device)
 
         while not done:
             if self.intf is not None:
@@ -303,7 +309,10 @@ class CdromInstallMethod(ImageInstallMethod):
                             _("That's not the correct %s CDROM.")
                                        % (productName,))
                     isys.umount("/mnt/source")
-                    isys.ejectCdrom(self.device)
+                    if self.noeject:
+                        log.info("noeject in effect, not ejecting cdrom")
+                    else:
+                        isys.ejectCdrom(self.device)
             except:
                 self.messageWindow(_("Error"), 
                         _("Unable to access the CDROM."))
@@ -327,7 +336,7 @@ class CdromInstallMethod(ImageInstallMethod):
 	except SystemError:
 	    pass
 
-    def __init__(self, method, rootPath, intf):
+    def __init__(self, method, rootPath, intf, noeject=False):
         """@param method cdrom://device:/path"""
         url = method[8:]
 	(self.device, tree) = string.split(url, ":", 1)
@@ -337,6 +346,7 @@ class CdromInstallMethod(ImageInstallMethod):
 	self.progressWindow = intf.progressWindow
 	self.waitWindow = intf.waitWindow
         self.loopbackFile = None
+        self.noeject = noeject
 
         # figure out which disc is in.  if we fail for any reason,
         # assume it's just disc1.
-- 
1.7.2.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux