Ejemplo n.º 1
0
    def execute(self):
        # show information window...
        info_window = InformationWindow(self, _("Please wait while installing bootloader!"))

        loader = yali.bootloader.BootLoader()

        root_part_req = ctx.partrequests.searchPartTypeAndReqType(
	    parttype.root, request.mountRequestType)

        loader.install_dev = basename(self.device.getPath())
        loader.install_root = basename(root_part_req.partition().getPath())
        
        # TODO: use logging!
        loader.write_grub_conf()

        # Windows partitions...
        for d in yali.storage.devices:
            for p in d.getPartitions():
                fs = p.getFSName()
                if fs in ("ntfs", "fat32"):
                    if is_windows_boot(p.getPath(), fs):
                        loader.win_fs = fs
                        loader.win_dev = basename(p.getDevicePath())
                        loader.win_root = basename(p.getPath())
                        loader.grub_conf_append_win()
                        continue


        if self.install_bootloader.isChecked():
            loader.install_grub()

        # close window
        info_window.close(True)

        return True
Ejemplo n.º 2
0
    def execute(self):

        def autopartDevice():
            dev = self.device

            # fist delete partitions on device
            dev.deleteAllPartitions()
            dev.commit()

            p = dev.addPartition(parttype.root.parted_type,
                                 parttype.root.filesystem,
                                 dev.getFreeMB(),
                                 parttype.root.parted_flags)
            p = dev.getPartition(p.num) # get partition.Partition
            dev.commit()

            ctx.partrequests.append(
                request.MountRequest(p, parttype.root))
            ctx.partrequests.append(
                request.FormatRequest(p, parttype.root))
            ctx.partrequests.append(
                request.SwapFileRequest(p, parttype.root))


        if self.accept_auto.isChecked():

            # show confirmation dialog
            w = WarningWidget(self)
            self.dialog = WarningDialog(w, self)
            if not self.dialog.exec_loop():
                # disabled by weaver
                ctx.screens.enablePrev()
                self.updateUI()
                return False

            # show information window...
            info_window = InformationWindow(self, _("Please wait while formatting!"))

            # inform user
            self.info.setText(_('<font color="#FF6D19">Preparing your disk for installation!</font>'))
            ctx.screens.processEvents()

            # remove all other requests (if there are any).
            ctx.partrequests.remove_all()

            ctx.use_autopart = True
            autopartDevice()
            # need to wait for devices to be created
            time.sleep(1)
            ctx.partrequests.applyAll()

            # skip next screen()
            num = ctx.screens.getCurrentIndex() + 1
            ctx.screens.goToScreen(num)

            # close window
            info_window.close(True)

        return True
Ejemplo n.º 3
0
    def execute(self):
        if self.noInstall.isChecked():
            return True
        
        # show information window...
        info_window = InformationWindow(self, _("Please wait while installing bootloader!"))

        loader = yali.bootloader.BootLoader()

        root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root,
                                                                  request.mountRequestType)

        if self.installPart.isChecked():
            install_dev = basename(root_part_req.partition().getPath())
        elif self.installMBR.isChecked():
            install_dev = basename(self.device.getPath())
        else:
            #install to hd0
            install_dev = str(filter(lambda u: u.isalpha(),basename(root_part_req.partition().getPath())))

        _ins_part = root_part_req.partition().getPath()
        
        ctx.debugger.log("Pardus installed to : %s" % _ins_part)
        ctx.debugger.log("GRUB will be installed to : %s" % install_dev)
        
        loader.write_grub_conf(_ins_part,install_dev)

        # Windows partitions...
        for d in yali.storage.devices:
            for p in d.getPartitions():
                fs = p.getFSName()
                #ctx.debugger.log("install_dev %s" % install_dev)
                #ctx.debugger.log("win_fs %s" % fs)
                #ctx.debugger.log("win_dev %s" % basename(p.getDevicePath()))
                #ctx.debugger.log("win_root %s" % basename(p.getPath()))
                if fs in ("ntfs", "fat32"):
                    if is_windows_boot(p.getPath(), fs):
                        win_fs = fs
                        win_dev = basename(p.getDevicePath())
                        win_root = basename(p.getPath())
                        loader.grub_conf_append_win(install_dev,
                                                    win_dev,
                                                    win_root,
                                                    win_fs)
                        continue

        # finally install it
        loader.install_grub(install_dev)

        # close window
        info_window.close(True)

        return True
Ejemplo n.º 4
0
    def execute(self):

        # show confirmation dialog
        w = WarningWidget(self)
        self.dialog = WarningDialog(w, self)
        if not self.dialog.exec_loop():
            # disabled by weaver.
            ctx.screens.enablePrev()
            
            self.partlist.update()
            return False


        # show information window...
        info_window = InformationWindow(self, _("Please wait while formatting!"))

        # commit events
        self.partlist.devices_commit()

        # inform user...
        self.partlist.showPartitionRequests(formatting=True)
        # process events and show partitioning information!
        ctx.screens.processEvents()
        
        
        ##
        # check swap partition, if not present use swap file
        rt = request.mountRequestType
        pt = parttype.swap
        swap_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt)

        if not swap_part_req:
            # No swap partition defined using swap as file in root
            # partition
            rt = request.mountRequestType
            pt = parttype.root
            root_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt)
            ctx.partrequests.append(
                request.SwapFileRequest(root_part_req.partition(),
                                        root_part_req.partitionType()))

        # apply all partition requests
        ctx.partrequests.applyAll()

        # close window
        info_window.close(True)
        return True
Ejemplo n.º 5
0
    def execute(self):

        w = WarningWidget(self)

        # We need different warning messages for Auto and Manual Partitioning
        if ctx.installData.autoPartDev:
            # show confirmation dialog
            w.warning.setText(_('''<b>
<p>This action will use your entire disk for Pardus installation and
all your present data on the selected disk will be lost.</p>

<p>After being sure you had your backup this is generally a safe
and easy way to install Pardus.</p>
</b>
'''))
        if not ctx.autoInstall:
            self.dialog = WarningDialog(w, self)
            if not self.dialog.exec_loop():
                # disabled by weaver
                ctx.screens.enablePrev()
                return False

        info_window = InformationWindow(self, _("Please wait while formatting!"))
        ctx.screens.processEvents()

        # We should do partitioning operations in here.

        # Auto Partitioning
        if ctx.installData.autoPartDev:
            ctx.partrequests.remove_all()
            ctx.use_autopart = True
            self.autopartDevice()
            time.sleep(1)
            ctx.partrequests.applyAll()

        # Manual Partitioning
        else:
            for dev in yali.storage.devices:
                dev.commit()
            # wait for udev to create device nodes
            time.sleep(2)
            self.checkSwap()
            ctx.partrequests.applyAll()

        info_window.close()

        root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root,
                                                                  request.mountRequestType)

        # install_dev
        if self.noInstall.isChecked():
            ctx.installData.bootLoaderDev = None
        elif self.installPart.isChecked():
            ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath())
        elif self.installMBR.isChecked():
            ctx.installData.bootLoaderDev = basename(self.device.getPath())
        else:
            if len(yali.storage.devices) > 1:
                self.orderedDiskList = yali.storage.getOrderedDiskList()
                ctx.installData.bootLoaderDev = basename(self.orderedDiskList[0])
            else:
                ctx.installData.bootLoaderDev = str(basename(root_part_req.partition().getPath()))

        _ins_part = root_part_req.partition().getPath()

        ctx.debugger.log("Pardus installed to : %s" % _ins_part)
        ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev)

        return True
Ejemplo n.º 6
0
    def execute(self):

        w = WarningWidget(self)

        # We need different warning messages for Auto and Manual Partitioning
        if ctx.installData.autoPartDev:
            # show confirmation dialog
            w.warning.setText(_('''<b>
<p>This action will use your entire disk for Pardus installation and
all your present data on the selected disk will be lost.</p>

<p>After being sure you had your backup this is generally a safe
and easy way to install Pardus.</p>
</b>
'''))
        self.dialog = WarningDialog(w, self)
        if not self.dialog.exec_loop():
            # disabled by weaver
            ctx.screens.enablePrev()
            return False

        info_window = InformationWindow(self, _("Please wait while formatting!"))
        ctx.screens.processEvents()

        # We should do partitioning operations in here.

        # Auto Partitioning
        if ctx.installData.autoPartDev:
            ctx.partrequests.remove_all()
            ctx.use_autopart = True
            self.autopartDevice()
            time.sleep(1)
            ctx.partrequests.applyAll()

        # Manual Partitioning
        else:
            for dev in yali.storage.devices:
                dev.commit()
            # wait for udev to create device nodes
            time.sleep(2)
            self.checkSwap()
            ctx.partrequests.applyAll()

        info_window.close()

        if self.noInstall.isChecked():
            ctx.installData.bootLoaderDev = None

        # show information window...
        # info_window = InformationWindow(self, _("Please wait while installing bootloader!"))

        # loader = yali.bootloader.BootLoader()

        root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root,
                                                                  request.mountRequestType)

        # install_dev

        if self.installPart.isChecked():
            ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath())
        elif self.installMBR.isChecked():
            ctx.installData.bootLoaderDev = basename(self.device.getPath())
        else:
            ctx.installData.bootLoaderDev = str(filter(lambda u: u.isalpha(),
                                                       basename(root_part_req.partition().getPath())))

        _ins_part = root_part_req.partition().getPath()

        ctx.debugger.log("Pardus installed to : %s" % _ins_part)
        ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev)

        # loader.write_grub_conf(_ins_part,ctx.installData.bootLoaderDev)

        # Windows partitions...
        #for d in yali.storage.devices:
        #    for p in d.getPartitions():
        #        fs = p.getFSName()
        #        if fs in ("ntfs", "fat32"):
        #            if is_windows_boot(p.getPath(), fs):
        #                win_fs = fs
        #                win_dev = basename(p.getDevicePath())
        #                win_root = basename(p.getPath())
        #                loader.grub_conf_append_win(install_dev,
        #                                            win_dev,
        #                                            win_root,
        #                                            win_fs)
        #                continue

        # finally install it
        # loader.install_grub(install_dev)

        # close window
        # info_window.close(True)

        return True