Commits

Moises Henriquez committed c9f51b5

Detecting chroot problem on bootloaders

  • Participants
  • Parent commits 1215ab2

Comments (0)

Files changed (3)

File src/vasm/backend/BOOTLOADERS.py

             if LOADER_CONFIGS.has_key(loader):
                 if os.path.exists(LOADER_CONFIGS[loader]):
                     return loader
+    # Return the default bootloader if nothing else.
+    return DEFAULT_BOOTLOADER
 
 class Entry(object):
     def __init__(self):

File src/vasm/ui/gtk2/modules/bootloaders.py

         elif self._grubrb.get_active():
             return self.apply_grub2_event()
     
+    def check_for_bootsector_availability(self):
+        # FIXME:
+        # Add some checks to make sure we have a bootsector available.
+        # If we are running in a chroot, this will fail.
+        pass
+    
     def apply_lilo_event(self, button=None):
         """ Apply event for when lilo is the selected bootloader """
         res = dialogs.question(" ".join(self._warning), parent = self._parent)

File src/vasm/ui/tui/modules/tui_bootloaders.py

     def __init__(self, parent):
         self.parent = parent
         bsector = BOOTLOADERS.get_current_bootsector()
-        rootdev = bsector[:len('/dev/sda'):]
-        currentbootloader = BOOTLOADERS.MBR(rootdev).read_bootloader() or \
+        # FIXME:
+        # When running in a chroot environment, this will produce an error
+        # because the chroot has no / mountpoint            
+        if bsector:
+            rootdev = bsector[:len('/dev/sda'):]
+            currentbootloader = BOOTLOADERS.MBR(rootdev).read_bootloader() or \
             BOOTLOADERS.DEFAULT_BOOTLOADER
+        else:
+            currentbootloader = BOOTLOADERS.DEFAULT_BOOTLOADER
         msg = (
             _("Select which bootloader you would like to use."), "\n",
             _("WARNING: this tool will over-write the target you selecct below."), "  ",