PATCH: Detecting grub failure

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

 



Hi

The attached patch adds checking for the exitcode from grub.

The old code silently ignored failures from grub, which makes debugging
more difficult.

--- python/bootloader.py        (revision 47239)
+++ python/bootloader.py        (working copy)
@@ -1,4 +1,5 @@
 import os
+import sys
 from iutil import getArch, getDiskPart, execWithRedirect, devify
 import isys
 import raid
@@ -274,13 +275,16 @@
         for cmd in cmds:
             os.write(p[1], cmd + '\n')
         os.close(p[1])
-        execWithRedirect(grubbin,
+        status = execWithRedirect(grubbin,
                          [ "grub",  "--batch", "--no-floppy",
                            "--device-map=/boot/grub/device.map" ],
                          stdin = p[0],
                          stdout = "/dev/tty5", stderr = "/dev/tty5",
                          root = instRoot)
         os.close(p[0])
+        if status:
+            log("Grub failed with exitcode %d" % status)
+            sys.exit(0)

         return

-- 
Ragnar Kjørstad
Software Engineer
Scali - http://www.scali.com
Scaling the Linux Datacenter


[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