[PATCH 2/2] display reIPL information before reboot

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

 



Display reIPL information before a reboot so that the user knows
which partition the 390 will reboot into. This can help diagnose
an error if the 390 will mistakenly reboot into a different partition
than expected. It also conveniently displays reboot information
rather than relying on the user know the correct place to get the
information out of.

---
anaconda | 2 ++
gui.py | 1 +
iutil.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/anaconda b/anaconda
index 78e5fd1..1b2cf64 100755
--- a/anaconda
+++ b/anaconda
@@ -1052,6 +1052,8 @@ if __name__ == "__main__":
log.info("attempting to eject %s" % drive.path)
drive.eject()

+ iutil.dumpReIPLFiles ()
+
del anaconda.intf

# vim:tw=78:ts=4:et:sw=4
diff --git a/gui.py b/gui.py
index 4379bec..e1753e3 100755
--- a/gui.py
+++ b/gui.py
@@ -1324,6 +1324,7 @@ class InstallControlWindow:
takeScreenShot()

def _doExit (self, *args):
+ iutil.dumpReIPLFiles ()
gtk.main_quit()
os._exit(0)

diff --git a/iutil.py b/iutil.py
index 39d398a..da97256 100644
--- a/iutil.py
+++ b/iutil.py
@@ -38,6 +38,11 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
import logging
log = logging.getLogger("anaconda")

+tty3_handler = logging.FileHandler("/dev/tty3")
+reIPL_log = logging.getLogger("reIPL")
+reIPL_log.addHandler(tty3_handler)
+reIPL_log.setLevel(logging.INFO)
+
#Python reimplementation of the shell tee process, so we can
#feed the pipe output into two places at the same time
class tee(threading.Thread):
@@ -1014,6 +1019,63 @@ def reIPL(anaconda, loader_pid):
# or a two-item list with errorMessage and rebootInstr (=> shutdown)
return message

+def stringFileContents (filename):
+ try:
+ data = ""> +
+ fp = open (filename)
+
+ data = "" ().strip ()
+
+ fp.close ()
+
+ dataContents = ""
+
+ for ch in data:
+ if ch in string.printable:
+ dataContents += ch
+ else:
+ dataContents = None
+ break
+
+ if dataContents is not None:
+ return dataContents
+
+ dataContents = ""
+
+ for ch in data:
+ dataContents += hex (ord (ch)) + " "
+
+ return dataContents
+
+ except Excception, e:
+
+ return "ERROR"
+
+def dumpReIPLFiles ():
+ try:
+ filename = "/sys/firmware/reipl/reipl_type"
+
+ if not os.path.isfile (filename):
+ return
+
+ type = stringFileContents (filename)
+
+ reIPL_log.info ("%s = %s" % (filename, type,))
+
+ directory = "/sys/firmware/reipl/%s" % (type,)
+
+ if not os.path.exists (directory):
+ return
+
+ for directoryFile in os.listdir (directory):
+ contents = stringFileContents ("%s/%s" % (directory, directoryFile,))
+
+ reIPL_log.info ("%s/%s = %s" % (directory, directoryFile, contents,))
+
+ except Exception, e:
+ log.info("dumpReIPLFiles: Caught exception %s", (e,))
+
def resetRpmDb(rootdir):
for rpmfile in glob.glob("%s/var/lib/rpm/__db.*" % rootdir):
try:
--
1.6.4.4

--
Mark

You must be the change you wish to see in the world. -- Mahatma Gandhi
Worrying is praying for that you do not wish to happen.

_______________________________________________
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