コード例 #1
0
ファイル: task_gui.py プロジェクト: icomfort/anaconda
    def createDialog(self):

        if self.repo:
            self.nameEntry.set_text(self.repo.name)
            if self.repo.anacondaBaseURLs:
                url = self.repo.anacondaBaseURLs[0]
            else:
                url = ''
            self.typeComboBox.set_active(self._methodToIndex(url))

            if not url or url.startswith("http") or url.startswith("ftp"):
                if self.repo.mirrorlist:
                    self.baseurlEntry.set_text(self.repo.mirrorlist)
                    self.mirrorlistCheckbox.set_active(True)
                else:
                    self.baseurlEntry.set_text(url)

                    self.mirrorlistCheckbox.set_active(False)

                if self.repo.proxy:
                    self.proxyCheckbox.set_active(True)
                    self.proxyTable.set_sensitive(True)
                    self.proxyEntry.set_text(self.repo.proxy)
                    self.usernameEntry.set_text(self.repo.proxy_username or '')
                    self.passwordEntry.set_text(self.repo.proxy_password or '')
                else:
                    self.proxyCheckbox.set_active(False)
                    self.proxyTable.set_sensitive(False)
            elif url.startswith("nfs"):
                (opts, server, path) = iutil.parseNfsUrl(url)
                self.nfsServerEntry.set_text(server)
                self.nfsPathEntry.set_text(path)
                self.nfsOptionsEntry.set_text(opts)
            elif url.startswith("cdrom:"):
                pass
            elif url.startswith("hd:"):
                m = url[3:]
                if m.count(":") == 1:
                    (device, path) = m.split(":")
                    fstype = "auto"
                else:
                    (device, fstype, path) = m.split(":")

                # find device in self.partitionComboBox and select it
                self.directoryChooser.set_current_folder("%s%s" % (self.anaconda.backend.ayum.isodir, path))
            else:
                self.baseurlEntry.set_text(url)

        else:
            self.typeComboBox.set_active(0)
            self.proxyCheckbox.set_active(False)
            self.proxyTable.set_sensitive(False)

        gui.addFrame(self.dialog)

        lbl = self.dxml.get_widget("descLabel")
        txt = lbl.get_text()
        lbl.set_text(txt)

        self.dialog.show_all()
コード例 #2
0
ファイル: task_gui.py プロジェクト: 274914765/python
    def createDialog(self):

        if self.repo:
            self.nameEntry.set_text(gettext.ldgettext("comps", self.repo.name))
            if self.repo.anacondaBaseURLs:
                url = self.repo.anacondaBaseURLs[0]
            else:
                url = ''
            self.typeComboBox.set_active(self._methodToIndex(url))

            if not url or url.startswith("http") or url.startswith("ftp"):
                if self.repo.mirrorlist:
                    self.baseurlEntry.set_text(self.repo.mirrorlist)
                    self.mirrorlistCheckbox.set_active(True)
                else:
                    self.baseurlEntry.set_text(url)

                    self.mirrorlistCheckbox.set_active(False)

                if self.repo.proxy:
                    self.proxyCheckbox.set_active(True)
                    self.proxyTable.set_sensitive(True)
                    self.proxyEntry.set_text(self.repo.proxy)
                    self.usernameEntry.set_text(self.repo.proxy_username or '')
                    self.passwordEntry.set_text(self.repo.proxy_password or '')
                else:
                    self.proxyCheckbox.set_active(False)
                    self.proxyTable.set_sensitive(False)
            elif url.startswith("nfs"):
                (opts, server, path) = iutil.parseNfsUrl(url)
                self.nfsServerEntry.set_text(server)
                self.nfsPathEntry.set_text(path)
                self.nfsOptionsEntry.set_text(opts)
            elif url.startswith("cdrom:"):
                pass
            elif url.startswith("hd:"):
                m = url[3:]
                if m.count(":") == 1:
                    (device, path) = m.split(":")
                    fstype = "auto"
                else:
                    (device, fstype, path) = m.split(":")

                # find device in self.partitionComboBox and select it
                self.directoryChooser.set_current_folder("%s%s" % (self.anaconda.backend.ayum.isodir, path))
            else:
                self.baseurlEntry.set_text(url)

        else:
            self.typeComboBox.set_active(0)
            self.proxyCheckbox.set_active(False)
            self.proxyTable.set_sensitive(False)

        gui.addFrame(self.dialog)

        lbl = self.dxml.get_widget("descLabel")
        txt = lbl.get_text()
        lbl.set_text(txt)

        self.dialog.show_all()
コード例 #3
0
ファイル: image.py プロジェクト: mattias-ohlsson/anaconda
def mountDirectory(methodstr, messageWindow):
    # No need to mount it again.
    if os.path.ismount("/mnt/install/isodir"):
        return

    if methodstr.startswith("hd:"):
        method = methodstr[3:]
        options = ''
        if method.count(":") == 1:
            (device, path) = method.split(":")
            fstype = "auto"
        else:
            (device, fstype, path) = method.split(":")

        if not device.startswith("/dev/") and not device.startswith("UUID=") \
           and not device.startswith("LABEL="):
            device = "/dev/%s" % device
    elif methodstr.startswith("nfsiso:"):
        (options, host, path) = iutil.parseNfsUrl(methodstr)
        if path.endswith(".iso"):
            path = os.path.dirname(path)
        device = "%s:%s" % (host, path)
        fstype = "nfs"
    else:
        return

    while True:
        try:
            isys.mount(device, "/mnt/install/isodir", fstype=fstype, options=options)
            break
        except SystemError as msg:
            log.error("couldn't mount ISO source directory: %s" % msg)
            ans = messageWindow(_("Couldn't Mount ISO Source"),
                          _("An error occurred mounting the source "
                            "device %s.  This may happen if your ISO "
                            "images are located on an advanced storage "
                            "device like LVM or RAID, or if there was a "
                            "problem mounting a partition.  Click exit "
                            "to abort the installation.")
                          % (device,), type="custom", custom_icon="error",
                          custom_buttons=[_("_Exit"), _("_Retry")])

            if ans == 0:
                sys.exit(0)
            else:
                continue
コード例 #4
0
def mountDirectory(methodstr, messageWindow):
    if methodstr.startswith("hd:"):
        method = methodstr[3:]
        options = ''
        if method.count(":") == 1:
            (device, path) = method.split(":")
            fstype = "auto"
        else:
            (device, fstype, path) = method.split(":")

        if not device.startswith("/dev/") and not device.startswith("UUID=") \
           and not device.startswith("LABEL="):
            device = "/dev/%s" % device
    elif methodstr.startswith("nfsiso:"):
        (options, host, path) = iutil.parseNfsUrl(methodstr)
        device = "%s:%s" % (host, path)
        fstype = "nfs"
    else:
        return

    # No need to mount it again.
    if os.path.ismount("/mnt/isodir"):
        return

    while True:
        try:
            isys.mount(device, "/mnt/isodir", fstype=fstype, options=options)
            break
        except SystemError, msg:
            log.error("couldn't mount ISO source directory: %s" % msg)
            ans = messageWindow(_("Couldn't Mount ISO Source"),
                                _("An error occurred mounting the source "
                                  "device %s.  This may happen if your ISO "
                                  "images are located on an advanced storage "
                                  "device like LVM or RAID, or if there was a "
                                  "problem mounting a partition.  Click exit "
                                  "to abort the installation.") % (device, ),
                                type="custom",
                                custom_icon="error",
                                custom_buttons=[_("_Exit"),
                                                _("_Retry")])

            if ans == 0:
                sys.exit(0)
            else:
                continue