[PATCH] Make default media eject behavior match old behavior

Will Woods wwoods at redhat.com
Thu Feb 28 21:02:56 UTC 2013


Previous versions of anaconda ejected the media by default for
interactive installs.

After commit a724f80 (May 2007), kickstart installs needed to pass
"reboot --eject" to make the drive eject. (See bug #238711, #239002)

Commit 2f601d2 (Sep 2010) added the "noeject" boot argument, which
overrides both the default and the kickstart command. (See bug #477887)

This patch should restore this behavior:
a) Eject is enabled by default, but
b) disabled for automatedInstall unless "reboot --eject" is used, and
c) disabled if "noeject" is passed as a boot argument.
---
 anaconda            | 5 ++++-
 pyanaconda/flags.py | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/anaconda b/anaconda
index 8c5a8a9..604ad1d 100755
--- a/anaconda
+++ b/anaconda
@@ -64,7 +64,7 @@ def exitHandler(rebootData, storage, exitCode=None):
         from pykickstart.constants import KS_SHUTDOWN, KS_WAIT, KS_REBOOT
         from pyanaconda.iutil import dracut_eject
 
-        if rebootData.eject:
+        if flags.eject or rebootData.eject:
             for drive in storage.devicetree.devices:
                 if drive.type != "cdrom":
                     continue
@@ -286,6 +286,7 @@ def parseOptions(argv=None, cmdline=None):
     op.add_option("--memcheck", action="store_true", default=True)
     op.add_option("--nomemcheck", action="store_false", dest="memcheck")
     op.add_option("--leavebootorder", action="store_true", default=False)
+    op.add_option("--noeject", action="store_false", dest="eject", default=True)
 
     # some defaults change based on cmdline flags
     if cmdline is not None:
@@ -808,6 +809,7 @@ if __name__ == "__main__":
     flags.dmraid = opts.dmraid
     flags.mpath = opts.mpath
     flags.selinux = opts.selinux
+    flags.eject = opts.eject
 
     if can_touch_runtime_system("start audit daemon"):
         startAuditDaemon()
@@ -841,6 +843,7 @@ if __name__ == "__main__":
     ksdata = None
     if opts.ksfile:
         flags.automatedInstall = True
+        flags.eject = False
         files = [opts.ksfile]
     else:
         files = ["/tmp/updates/interactive-defaults.ks",
diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
index c6fdcc7..5538266 100644
--- a/pyanaconda/flags.py
+++ b/pyanaconda/flags.py
@@ -69,6 +69,7 @@ class Flags(object):
         self.automatedInstall = False
         self.dirInstall = False
         self.askmethod = False
+        self.eject = True
         # for non-physical consoles like some ppc and sgi altix,
         # we need to preserve the console device and not try to
         # do things like bogl on them.  this preserves what that
-- 
1.8.1.2



More information about the anaconda-patches mailing list