Example #1
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.__check_destination(dst):
            self.warning_dialog(self.tr("Directory is Invalid"), self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__get_source_info(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 = get_mounted(dst)
        (capacity, available, used) = get_disk_info(dst)

        # Mount iso
        if not os.path.ismount(self.iso_dir):
            cmd = "fuseiso %s %s" % (src, self.iso_dir)
            if run_command(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.get_total_size()

        if available < total_size:
            self.warning_dialog("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:
                create_USB_dirs(dst)
                self.__create_image(src, dst)

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

        run_command("fusermount -u %s" % self.iso_dir)
Example #2
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.__check_destination(dst):
            self.warning_dialog(self.tr("Directory is Invalid"), self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__get_source_info(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 = get_mounted(dst)
        (capacity, available, used) = get_disk_info(dst)

        # Mount iso
        if not os.path.ismount(self.iso_dir):
            cmd = "fuseiso %s %s" % (src, self.iso_dir)
            if run_command(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.get_total_size()

        if available < total_size:
            self.warning_dialog("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:
                create_USB_dirs(dst)
                self.__create_image(src, dst)

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

        run_command("fusermount -u %s" % self.iso_dir)
Example #3
0
    def __create_image(self, src, dst):
        create_USB_dirs(dst)

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

            return False

        self.__copy_image(self.iso_dir, dst)

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

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

        return True
Example #4
0
    def __create_image(self, src, dst):
        create_USB_dirs(dst)

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

            return False

        self.__copy_image(self.iso_dir, dst)

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

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

        return True