Exemple #1
0
 def on_grub2_edit_button_clicked(self, widget, data=None):
     partition = os.path.join("/dev", self.cfg.cur_boot_partition)
     if slt.isMounted(partition):
         mp = slt.getMountPoint(partition)
         doumount = False
     else:
         mp = slt.mountDevice(partition)
         doumount = True
     grub2cfg = os.path.join(mp, "etc/default/grub")
     if os.path.exists(grub2cfg):
         launched = False
         for editor in self._editors:
             try:
                 cmd = editor.split(" ") + [grub2cfg]
                 slt.execCall(cmd, shell=True, env=None)
                 launched = True
                 break
             except:
                 pass
         if not launched:
             self._bootsetup.error_dialog(
                 _(
                     "Sorry, BootSetup is unable to find a suitable text editor in your system. You will not be able to manually modify the Grub2 default configuration.\n"
                 )
             )
     if doumount:
         slt.umountDevice(mp)
Exemple #2
0
 def _umountAll(self, mountPoint):
   self.__debug("umountAll")
   if mountPoint:
     self.__debug("umounting main mount point " + mountPoint)
     self._unbindProcSysDev(mountPoint)
     if self._bootInBootMounted:
       self.__debut("/boot mounted in " + mountPoint + ", so umount it")
       slt.execCall("chroot {mp} /sbin/umount /boot".format(mp=mountPoint))
     if mountPoint != '/':
       self.__debug("umain mount point ≠ '/' → umount " + mountPoint)
       slt.umountDevice(mountPoint)
   self._bootInBootMounted = False
   self._procInBootMounted = False
Exemple #3
0
 def _updateGrub2EditButton(self, doTest=True):
   if doTest:
     partition = os.path.join("/dev", self.cfg.cur_boot_partition)
     if slt.isMounted(partition):
       mp = slt.getMountPoint(partition)
       doumount = False
     else:
       mp = slt.mountDevice(partition)
       doumount = True
     self._grub2_conf = os.path.exists(os.path.join(mp, "etc/default/grub"))
     if doumount:
       slt.umountDevice(mp)
   else:
     self._grub2_conf = False
   self._grub2BtnEdit.sensitive = self._grub2_conf
   self._updateScreen()
Exemple #4
0
 def update_buttons(self):
     install_ok = False
     multiple = False
     grub2_edit_ok = False
     if (
         self.cfg.cur_mbr_device
         and os.path.exists("/dev/{0}".format(self.cfg.cur_mbr_device))
         and slt.getDiskInfo(self.cfg.cur_mbr_device)
     ):
         if self.cfg.cur_bootloader == "lilo" and not self._editing:
             if len(self.BootPartitionListStore) > 1:
                 multiple = True
             for bp in self.BootPartitionListStore:
                 if bp[4] == "gtk-yes":
                     install_ok = True
         elif self.cfg.cur_bootloader == "grub2":
             if (
                 self.cfg.cur_boot_partition
                 and os.path.exists("/dev/{0}".format(self.cfg.cur_boot_partition))
                 and slt.getPartitionInfo(self.cfg.cur_boot_partition)
             ):
                 install_ok = True
             if install_ok:
                 partition = os.path.join("/dev", self.cfg.cur_boot_partition)
                 if slt.isMounted(partition):
                     mp = slt.getMountPoint(partition)
                     doumount = False
                 else:
                     mp = slt.mountDevice(partition)
                     doumount = True
                 grub2_edit_ok = os.path.exists(os.path.join(mp, "etc/default/grub"))
                 if doumount:
                     slt.umountDevice(mp)
     self.RadioLilo.set_sensitive(not self._editing)
     self.RadioGrub2.set_sensitive(not self._editing)
     self.ComboBoxMbr.set_sensitive(not self._editing)
     self.BootPartitionTreeview.set_sensitive(not self._custom_lilo)
     self.UpButton.set_sensitive(not self._editing and multiple)
     self.DownButton.set_sensitive(not self._editing and multiple)
     self.LiloUndoButton.set_sensitive(not self._editing and self._custom_lilo)
     self.LiloEditButton.set_sensitive(not self._editing and install_ok)
     self.Grub2EditButton.set_sensitive(grub2_edit_ok)
     self.ExecuteButton.set_sensitive(not self._editing and install_ok)
Exemple #5
0
 def _editGrub2Conf(self, button):
   partition = os.path.join("/dev", self.cfg.cur_boot_partition)
   if slt.isMounted(partition):
     mp = slt.getMountPoint(partition)
     doumount = False
   else:
     mp = slt.mountDevice(partition)
     doumount = True
   grub2cfg = os.path.join(mp, "etc/default/grub")
   launched = False
   for editor in self._editors:
     try:
       slt.execCall([editor, grub2cfg], shell=True, env=None)
       launched = True
       break
     except:
       pass
   if not launched:
     self._errorDialog(_("Sorry, BootSetup is unable to find a suitable text editor in your system. You will not be able to manually modify the Grub2 default configuration.\n"))
   if doumount:
     slt.umountDevice(mp)
Exemple #6
0
 def _umountAll(self, mountPoint, mountPointList):
   self.__debug("umountAll")
   if mountPoint:
     for mp in self._bootsMounted:
       self.__debug("umounting " + unicode(mp))
       slt.umountDevice(mp, deleteMountPoint=False)
     self._bootsMounted = []
     if mountPointList:
       self.__debug("umount other mount points: " + unicode(mountPointList))
       for mp in mountPointList.values():
         if mp == mountPoint:
           continue  # skip it, will be unmounted just next
         self.__debug("umount " + unicode(mp))
         slt.umountDevice(mp)
     if mountPoint != '/':
       self.__debug("main mount point ≠ '/' → umount " + mountPoint)
       slt.umountDevice(mountPoint)