示例#1
0
    def parseArgs(self, parser):
        parser.add_option("-l",
                          "--license",
                          dest="license",
                          action="store_true",
                          help=_("show program's license info and exit"))
        parser.add_option("-c",
                          "--create",
                          dest="create",
                          action="store_true",
                          help=_("create Pardus USB image from console"))

        return parser.parse_args()
示例#2
0
    def main(self):
        description = _("Puding is an USB image creator for Pardus Linux.")
        parser = OptionParser(description=description, version=VERSION)
        (opts, args) = self.parseArgs(parser)

        if opts.create:
            if not os.getuid() == 0:
                print(
                    _("You need superuser permissions to run this application."
                      ))

                sys.exit(0)

            try:
                from puding import uiCmd

                source = os.path.realpath(args[0])

                try:
                    destination = os.path.realpath(args[1])

                except:
                    destination = None

                uiCmd.Create(source, destination)

            except IndexError:
                print(_("Invalid usage. Example:"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso\n" % NAME)
                print(
                    _("(If you know directory path that is your USB device mount point)"
                      ))
                print(
                    "\t%s --create /mnt/archive/Pardus-2009.iso /media/disk" %
                    NAME)

        elif opts.license:
            print(LICENSE)

        else:
            from puding.uiQt import main

            main()
示例#3
0
    def parseArgs(self, parser):
        parser.add_option("-l",
                          "--license",
                          dest="license",
                          action="store_true",
                          help=_("show program's license info and exit"))
        parser.add_option("-c",
                          "--create",
                          dest="create",
                          action="store_true",
                          help=_("create Pardus USB image from console"))

        group = OptionGroup(parser, _("Graphical Interface Options"))
        group.add_option("--qt",
                         dest="with_qt",
                         action="store_true",
                         help=_("run Puding with Qt4 graphical interface"))

        parser.add_option_group(group)

        return parser.parse_args()
示例#4
0
    def main(self):
        description = _("Puding is an USB image creator for Pardus Linux.")
        parser = OptionParser(description = description, version = VERSION)
        (opts, args) = self.parseArgs(parser)

        if opts.create:
            if not os.getuid() == 0:
                print(_("You need superuser permissions to run this application."))

                sys.exit(0)

            try:
                from puding import uiCmd

                source = os.path.realpath(args[0])

                try:
                    destination = os.path.realpath(args[1])

                except:
                    destination = None

                uiCmd.Create(source, destination)

            except IndexError:
                print(_("Invalid usage. Example:"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso\n" % NAME)
                print(_("(If you know directory path that is your USB device mount point)"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso /media/disk" % NAME)

        elif opts.license:
            print(LICENSE)

        else:
            from puding.uiQt import main

            main()
示例#5
0
                    destination = None

                uiCmd.Create(source, destination)

            except IndexError:
                print(_("Invalid usage. Example:"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso\n" % NAME)
                print(
                    _("(If you know directory path that is your USB device mount point)"
                      ))
                print(
                    "\t%s --create /mnt/archive/Pardus-2009.iso /media/disk" %
                    NAME)

        elif opts.license:
            print(LICENSE)

        else:
            from puding.uiQt import main

            main()


if __name__ == "__main__":
    try:
        Options().main()

    except KeyboardInterrupt:
        print(_("\nQuitting, please wait."))
        unmountDirs()
示例#6
0
    def parseArgs(self, parser):
        parser.add_option("-l", "--license", dest = "license", action = "store_true", help = _("show program's license info and exit"))
        parser.add_option("-c", "--create", dest = "create", action = "store_true", help = _("create Pardus USB image from console"))

        return parser.parse_args()
示例#7
0
                try:
                    destination = os.path.realpath(args[1])

                except:
                    destination = None

                uiCmd.Create(source, destination)

            except IndexError:
                print(_("Invalid usage. Example:"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso\n" % NAME)
                print(_("(If you know directory path that is your USB device mount point)"))
                print("\t%s --create /mnt/archive/Pardus-2009.iso /media/disk" % NAME)

        elif opts.license:
            print(LICENSE)

        else:
            from puding.uiQt import main

            main()

if __name__ == "__main__":
    try:
        Options().main()

    except KeyboardInterrupt:
        print(_("\nQuitting, please wait."))
        unmountDirs()
示例#8
0
                print("\t%s --create /mnt/archive/Pardus-2009.iso\n" % NAME)
                print(
                    "(If you know directory path that is your USB device mount point)\n\
\t%s --create /mnt/archive/Pardus-2009.iso /media/disk" % NAME)

        elif opts.license:
            print(LICENSE)

        elif opts.with_qt:
            from puding.uiQt import main

            main()

        else:
            parser.print_help()


if __name__ == "__main__":
    createDirs()

    try:
        Options().main()

    except KeyboardInterrupt:
        if os.path.ismount(MOUNT_ISO):
            runCommand("fusermount -u %s" % MOUNT_ISO)
        if os.path.ismount(MOUNT_USB):
            runCommand("umount %s" % MOUNT_USB)

        print(_("\nQuit."))