Commits

Moises Henriquez  committed 1215ab2

Fix error produced with updating bootloaders and a partition is already mounted.

  • Participants
  • Parent commits 28c11fb

Comments (0)

Files changed (2)

File src/vasm/backend/BOOTLOADERS.py

                 return True
         return False
 
+    def get_partition_mountpoint(self, device, mountlist):
+        for item in mountlist:
+            if item.device == device:
+                return item.mountpoint
+        return None
+    
     def prepare_os_list(self, object_list):
         """ Copy kernels and initrd's from other Os's /boot to lilos /boot/tamu """
         # before we do anything, take a snapshot of the system to see
         # which partitions are now mounted
-        mountlist = utils.get_mounted_list()
+        mountlist = psutil.disk_partitions()
         try:
             os.makedirs("/boot/tamu")
         except:
                 mpoint = entry.root.replace("/dev/", "/mnt/")
                 kpath = os.path.join("/boot", "tamu", kname)
                 if not os.path.exists(kpath):
-                    # mount the partition
-                    mount = utils.mount(entry.root, mpoint)
+                    if not self._check_if_premounted(entry.root, mountlist):
+                        # mount the partition
+                        mount = utils.mount(entry.root, mpoint)
+                    else:
+                        mpoint = self.get_partition_mountpoint(entry.root, mountlist)
+                        assert mpoint is not None, \
+                            "Unable to get mountpoint for mounted partition %s"% entry.root
                     # copy the kernel now
                     entry.kernel = self._copy_kernel(entry.root, mpoint, kname)
                     

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

                     buttons = [("OK", self.return_to_module)]
                     )
                 self.return_to_module()
-                self.pop_dialog(dia)
+                self.pop_dialog(dia, 2)
                 logger.error("Error while running %s: %s"%(method.func_name, e))
                 return self.resume_ui()
             time.sleep(1)