[f17 master 2/2] use a dracut shutdown hook to eject media (#787461)

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

 



From: "Brian C. Lane" <bcl@xxxxxxxxxx>

Now that we are running from the squashfs.img on the install media
we cannot eject it until shutdown.

Anacona now uses a dracut shutdown hook to handle ejecting any media
that needs to be ejected.
---
 anaconda                    |    5 ++---
 pyanaconda/installmethod.py |    8 ++++----
 pyanaconda/yuminstall.py    |   34 +++++++++-------------------------
 3 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/anaconda b/anaconda
index 8d34f38..5074d6b 100755
--- a/anaconda
+++ b/anaconda
@@ -62,14 +62,13 @@ def exitHandler(anaconda, exitCode=None):
 
     if anaconda.ksdata and not flags.imageInstall:
         from pykickstart.constants import KS_SHUTDOWN, KS_WAIT, KS_REBOOT
+        from iutil import dracut_eject
 
         if anaconda.ksdata.reboot.eject:
             for drive in anaconda.storage.devicetree.devices:
                 if drive.type != "cdrom":
                     continue
-
-                log.info("attempting to eject %s" % drive.path)
-                drive.eject()
+                dracut_eject( drive.path )
 
         if anaconda.ksdata.reboot.action == KS_SHUTDOWN:
             os.system("systemctl --force --no-wall poweroff")
diff --git a/pyanaconda/installmethod.py b/pyanaconda/installmethod.py
index e96c54d..83fd51c 100644
--- a/pyanaconda/installmethod.py
+++ b/pyanaconda/installmethod.py
@@ -20,6 +20,7 @@
 
 import os, shutil, string
 from constants import *
+from iutil import dracut_eject
 
 import logging
 log = logging.getLogger("anaconda")
@@ -28,8 +29,7 @@ import isys, product
 
 def doMethodComplete(anaconda):
     def _ejectDevice():
-        # Ejecting the CD/DVD for kickstart is handled only after %post scripts
-        # have been run.
+        # Ejecting the CD/DVD for kickstart is handled at the end of anaconda
         if anaconda.ksdata:
             return None
 
@@ -41,7 +41,7 @@ def doMethodComplete(anaconda):
             dev = anaconda.stage2[8:].split(':')[0]
             return anaconda.storage.devicetree.getDeviceByName(dev)
 
-    anaconda.backend.complete(anaconda)
     dev = _ejectDevice()
     if dev:
-        dev.eject()
+        dracut_eject( dev.path )
+    anaconda.backend.complete(anaconda)
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index cd78d72..196229e 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -396,33 +396,17 @@ class AnacondaYum(yum.YumBase):
             if verifyMedia(self.tree, None):
                 return
 
-            dev.format.unmount()
+        dev.format.unmount()
 
-        dev.eject()
+        log.error("Wrong disc found on %s" % (self.tree))
+        if self.anaconda.intf:
+            self.anaconda.intf.beep()
 
-        while True:
-            if self.anaconda.intf:
-                self.anaconda.intf.beep()
-
-            self.anaconda.intf.messageWindow(_("Change Disc"),
-                _("Please insert the %(productName)s disc to continue.")
-                % {'productName': productName})
-
-            try:
-                dev.format.mount()
-
-                if verifyMedia(self.tree, self._timestamp):
-                    break
-
-                self.anaconda.intf.messageWindow(_("Wrong Disc"),
-                        _("That's not the correct %s disc.")
-                          % (productName,))
-
-                dev.format.unmount()
-                dev.eject()
-            except Exception:
-                self.anaconda.intf.messageWindow(_("Error"),
-                        _("Unable to access the disc."))
+            self.messageWindow(_("Wrong Disc"),
+                _("That's not the correct %s disc.") % (productName),
+                type="custom", custom_icon="error",
+                custom_buttons=[_("_Exit installer")])
+        sys.exit(1)
 
     def _mountInstallImage(self):
         umountImage(self.tree)
-- 
1.7.7.6

_______________________________________________
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