Example #1
0
    def __createImage(self, src, dst):
        createUSBDirs(dst)

        self.utils.cprint(_("Creating boot manager..."), "yellow")
        if createSyslinux(dst):
            self.utils.cprint(_("Could not create boot manager."), "red")

            return False

        self.__copyImage(MOUNT_ISO, dst)

        self.utils.cprint(_("Unmounting image..."), "green")
        cmd = "fusermount -u %s" % MOUNT_ISO

        if runCommand(cmd):
            self.utils.cprint(_("Could not unmounted image."), "red")

            return False

        if dst == MOUNT_USB:
            self.utils.cprint(_("Unmounting USB disk..."), "green")
            cmd = "umount %s" % MOUNT_USB

            if runCommand(cmd):
                self.utils.cprint(_("Could not unmounted USB disk."), "red")

                return False

        self.utils.cprint(_("USB disk is ready. Now you can install or run Pardus from your USB disk."), "brightgreen")

        return True
Example #2
0
    def __createImage(self, src, dst):
        createUSBDirs(dst)

        self.utils.cprint(_("Creating boot manager..."), "yellow")
        if createSyslinux(dst):
            self.utils.cprint(_("Could not create boot manager."), "red")

            return False

        self.__copyImage(MOUNT_ISO, dst)

        self.utils.cprint(_("Unmounting image..."), "green")
        cmd = "fusermount -u %s" % MOUNT_ISO

        if runCommand(cmd):
            self.utils.cprint(_("Could not unmounted image."), "red")

            return False

        if dst == MOUNT_USB:
            self.utils.cprint(_("Unmounting USB disk..."), "green")
            cmd = "umount %s" % MOUNT_USB

            if runCommand(cmd):
                self.utils.cprint(_("Could not unmounted USB disk."), "red")

                return False

        self.utils.cprint(
            _("USB disk is ready. Now you can install or run Pardus from your USB disk."
              ), "brightgreen")

        return True
Example #3
0
    def on_button_create_clicked(self):
        # FIXED issue: #1
        src = unicode(str(self.line_image.displayText()))
        dst = str(self.line_disk.displayText())

        if dst.startswith("/dev/"):
            from puding.pardusTools import Authorization

            auth = Authorization()
            auth.mount(dst, MOUNT_USB)
            dst = MOUNT_USB

        if not self.__checkDestination(dst):
            self.warningDialog(self.tr("Directory is Invalid"), self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__getSourceInfo(src)

        except TypeError: # 'bool' object is not iterable
            # It's not true way, you should warn to the users with WarningDialog.
            return False

        mount_point = getMounted(dst)
        (capacity, available, used) = getDiskInfo(dst)

        # Mount iso
        if not os.path.ismount(MOUNT_ISO):
            cmd = "fuseiso %s %s" % (src, MOUNT_ISO)
            if runCommand(cmd):
                # FIX ME: Should use warning dialog.
                return False

        # FIX ME: Now Puding supports only Pardus.
        from pardusTools import Main

        self.tools = Main(MOUNT_ISO, dst)
        total_size = self.tools.getTotalSize()

        if available < total_size:
            self.warningDialog("Warning", "There is not enough space left on your USB stick for the image.")

        else:
            self.confirm_infos = ConfirmDialog(src, dst, mount_point, name, total_size, capacity, available, used)

            if self.confirm_infos.exec_() == QtGui.QDialog.Accepted:
                createUSBDirs(dst)
                self.__createImage(src, dst)

                if dst == MOUNT_USB:
                    auth.umount(dst)

        # Unmount iso
        cmd = "fusermount -u %s" % MOUNT_ISO
        if runCommand(cmd):
            # FIX ME: Should use warning dialog.
            return False
Example #4
0
    def __createImage(self, src, dst):
        createUSBDirs(dst)

        self.utils.cprint(_("Creating boot manager..."), "yellow")
        if createSyslinux(dst):
            self.utils.cprint(_("Could not create boot manager."), "red")

            return False

        self.__copyImage(self.iso_dir, dst)

        self.utils.cprint(_("Unmounting image and USB disk..."), "green")
        unmountDirs()

        self.utils.cprint(_("USB disk is ready. Now you can install or run Pardus from your USB disk."), "brightgreen")

        return True
Example #5
0
    def __createImage(self, src, dst):
        createUSBDirs(dst)

        self.utils.cprint(_("Creating boot manager..."), "yellow")
        if createSyslinux(dst):
            self.utils.cprint(_("Could not create boot manager."), "red")

            return False

        self.__copyImage(self.iso_dir, dst)

        self.utils.cprint(_("Unmounting image and USB disk..."), "green")
        unmountDirs()

        self.utils.cprint(_("USB disk is ready. Now you can install or run Pardus from your USB disk."), "brightgreen")

        return True
Example #6
0
    def on_button_create_clicked(self):
        # FIXED issue: #1
        src = unicode(str(self.line_image.displayText()))
        dst = str(self.line_disk.displayText())

        if dst.startswith("/dev/"):
            device = dst
            dst = tempfile.mkdtemp(suffix="_usbPuding")

            from puding.pardusTools import Authorization

            auth = Authorization()
            auth.mount(device, dst)

        if not self.__checkDestination(dst):
            self.warningDialog(self.tr("Directory is Invalid"),
                               self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__getSourceInfo(src)

        except TypeError:  # 'bool' object is not iterable
            # It's not true way, you should warn to the users with WarningDialog.
            return False

        mount_point = getMounted(dst)
        (capacity, available, used) = getDiskInfo(dst)

        # Mount iso
        if not os.path.ismount(self.iso_dir):
            cmd = "fuseiso %s %s" % (src, self.iso_dir)
            if runCommand(cmd):
                # FIX ME: Should use warning dialog.
                return False

        # FIX ME: Now Puding supports only Pardus.
        from pardusTools import Main

        self.tools = Main(self.iso_dir, dst)
        total_size = self.tools.getTotalSize()

        if available < total_size:
            self.warningDialog(
                "Warning",
                "There is not enough space left on your USB stick for the image."
            )

        else:
            self.confirm_infos = ConfirmDialog(src, dst, mount_point, name,
                                               total_size, capacity, available,
                                               used)

            if self.confirm_infos.exec_() == QtGui.QDialog.Accepted:
                createUSBDirs(dst)
                self.__createImage(src, dst)

                if dst.endswith("Puding"):
                    auth.umount(dst)

        runCommand("fusermount -u %s" % self.iso_dir)