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

Re: [PATCH] Fix rescue mode startup with kickstart file and without (#515896)

On 05/25/2010 03:37 PM, Martin Sivak wrote:
We had several reboot problems in rescue mode when starting with kickstart or when using kickstart and 'rescue' option on the boot prompt.

1) Kickstart's install command had higher priority over command line options. This was really bad as it prevented user to start rescue using our standard PXE targets. This changes it so cmdline option has higher priority.

2) Rescue automatically and unconditionally rebooted after processing the kickstart. This was equally bad as it wasn't possible to use kickstart to specify all location data and start rescue with it. This patch changes the code to honour the reboot command in kickstart and to start a shell if no such command is present in the kickstart.
  anaconda  |    2 +-
  rescue.py |   15 ++++++++++++---
  2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/anaconda b/anaconda
index 7be6cc8..d7ac2c4 100755
--- a/anaconda
+++ b/anaconda
@@ -812,7 +812,7 @@ if __name__ == "__main__":

          kickstart.preScriptPass(anaconda, opts.ksfile)
          ksdata = kickstart.parseKickstart(anaconda, opts.ksfile)
-        opts.rescue = ksdata.rescue.rescue
+        opts.rescue = opts.rescue or ksdata.rescue.rescue

      if flags.sshd:
          # we need to have a libuser.conf that points to the installer root for
diff --git a/rescue.py b/rescue.py
index b613bbd..632d6ad 100644
--- a/rescue.py
+++ b/rescue.py
@@ -37,6 +37,7 @@ import shutil
  import time
  import network
  import subprocess
+from pykickstart.constants import *

  import gettext
  _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -466,7 +467,8 @@ def runRescue(anaconda, instClass):
                        "automatically when you exit from the shell.") % (anaconda.rootPath,),
                        [_("OK")] )
-        if anaconda.isKickstart:
+        if anaconda.isKickstart and \
+               anaconda.id.ksdata.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
              log.info("No Linux partitions found")
              print(_("You don't have any Linux partitions.  Rebooting.\n"))
@@ -487,15 +489,22 @@ def runRescue(anaconda, instClass):
          except Exception, e:
              log.error("error making a resolv.conf: %s" %(e,))
          msgStr = _("Your system is mounted under the %s directory.") % (anaconda.rootPath,)
+        ButtonChoiceWindow(screen, _("Rescue"), msgStr, [_("OK")] )

+    # we do not need ncurses anymore, shut them down
+    screen.finish()
      #create /etc/fstab in ramdisk, so it is easier to work with RO mounted filesystems

      # run %post if we've mounted everything
-    if anaconda.isKickstart:
+    if rootmounted and not readOnly and anaconda.isKickstart:
          from kickstart import runPostScripts
-    else:
+    # start shell if reboot wasn't requested
+    if not anaconda.isKickstart or \
+           not anaconda.id.ksdata.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
          runShell(screen, msgStr)



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