示例#1
0
    def initialize(self):
        """
        The initialize method that is called after the instance is created.
        The difference between __init__ and this method is that this may take
        a long time and thus could be called in a separated thread.

        :see: pyanaconda.ui.common.UIObject.initialize

        """
        # If KickStart provided apply values to spoke
        NormalTUISpoke.initialize(self)
        self.link = "<URL>"
        if self.data.addons.org_centos_cloud.state == "False":
            # Addon is Disabled
            self.state = False
            self.mode = "disabled"
        else:  # DEFAULT
            self.state = True
            if (
                self.data.addons.org_centos_cloud.arguments == "--allinone"
                or self.data.addons.org_centos_cloud.arguments == "none"
            ):
                self.mode = "allinone"
            else:  # ANSWER FILE
                self.link = str(self.data.addons.org_centos_cloud.arguments).replace("--answer-file=", "")
                self.mode = "answerfile"
        self.data.addons.org_centos_cloud.state = str(self.state)
示例#2
0
    def refresh(self, args=None):
        """ Refresh screen. """
        self._load_new_devices()
        NormalTUISpoke.refresh(self, args)

        self._container = ListColumnContainer(1, columns_width=78, spacing=1)

        summary = self._summary_text()
        self.window.add_with_separator(TextWidget(summary))
        hostname = _("Host Name: %s\n") % self._network_module.proxy.Hostname
        self.window.add_with_separator(TextWidget(hostname))
        current_hostname = _("Current host name: %s\n") % self._network_module.proxy.GetCurrentHostname()
        self.window.add_with_separator(TextWidget(current_hostname))

        # if we have any errors, display them
        while len(self.errors) > 0:
            self.window.add_with_separator(TextWidget(self.errors.pop()))

        dialog = Dialog(_("Host Name"))
        self._container.add(TextWidget(_("Set host name")), callback=self._set_hostname_callback, data=dialog)

        for dev_name in self.supported_devices:
            text = (_("Configure device %s") % dev_name)
            self._container.add(TextWidget(text), callback=self._configure_network_interface, data=dev_name)

        self.window.add_with_separator(self._container)
示例#3
0
    def __init__(self, app, data, storage, payload, instclass):
        NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)

        self._ready = False
        self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.selection = None

        self.autopart = None
        self.clearPartType = None

        # This list gets set up once in initialize and should not be modified
        # except perhaps to add advanced devices. It will remain the full list
        # of disks that can be included in the install.
        self.disks = []
        self.errors = []
        self.warnings = []

        if self.data.zerombr.zerombr and arch.isS390():
            # if zerombr is specified in a ks file and there are unformatted
            # dasds, automatically format them. pass in storage.devicetree here
            # instead of storage.disks since mediaPresent is checked on disks;
            # a dasd needing dasdfmt will fail this media check though
            to_format = storage.devicetree.make_unformatted_dasd_list(getDisks(self.storage.devicetree))
            if to_format:
                self.run_dasdfmt(to_format)

        if not flags.automatedInstall:
            # default to using autopart for interactive installs
            self.data.autopart.autopart = True
示例#4
0
    def refresh(self, args=None):
        """
        The refresh method that is called every time the spoke is displayed.
        It should update the UI elements according to the contents of
        self.data.

        :see: pyanaconda.ui.common.UIObject.refresh
        :see: pyanaconda.ui.tui.base.UIScreen.refresh
        :param args: optional argument that may be used when the screen is
                     scheduled (passed to App.switch_screen* methods)
        :type args: anything
        :return: whether this screen requests input or not
        :rtype: bool

        """
        NormalTUISpoke.refresh(self, args)
        # It should always prompt
        box1 = CheckboxWidget(
            title="1. Enable Cloud Support",
            text="OpenStack MODE: " + str(self.data.addons.org_centos_cloud.arguments),
            completed=(self.data.addons.org_centos_cloud.state == "True"),
        )
        box2 = CheckboxWidget(
            title=("2. Disable Cloud Support"), completed=(self.data.addons.org_centos_cloud.state == "False")
        )
        self._window += [box1, "", box2, ""]
        return self.enabled  # Don't Prompt if ADDON was disabled during setup, because no packages have been installed
示例#5
0
    def initialize(self):
        NormalTUISpoke.initialize(self)

        threadMgr.add(AnacondaThread(name=THREAD_STORAGE_WATCHER,
                                     target=self._initialize))

        self.selected_disks = self.data.ignoredisk.onlyuse[:]
    def initialize(self):
        """
        The initialize method that is called after the instance is created.
        The difference between __init__ and this method is that this may take
        a long time and thus could be called in a separated thread.

        :see: pyanaconda.ui.common.UIObject.initialize

        """
        NormalTUISpoke.initialize(self)

        self.enabled = True
        self.msg = ""
        self.data.addons.org_centos_cloud.env = "firstboot"
        if self.data.addons.org_centos_cloud.state == "False":
            #Addon is disabled
            self.enabled = False
            self.complete = True
            self.msg = "Cloud Support: Disabled"
        elif self.data.addons.org_centos_cloud.state == "True":
            # Addon is enabled
            # Case mode is also specified in KS
            if str(self.data.addons.org_centos_cloud.arguments).startswith("--answer-file"):
                self.complete = True
                self.msg = "PackStack Mode: " + str(self.data.addons.org_centos_cloud.arguments)
            else:
                # DEFAULT MODE: --allinone is assumed
                self.complete = True
                self.msg = "PackStack Mode: --alinone"
示例#7
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # Join the initialization thread to block on it
        # This print is foul.  Need a better message display
        print(_(PAYLOAD_STATUS_PROBING_STORAGE))
        threadMgr.wait(THREAD_STORAGE_WATCHER)

        # synchronize our local data store with the global ksdata
        # Commment out because there is no way to select a disk right
        # now without putting it in ksdata.  Seems wrong?
        #self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.autopart = self.data.autopart.autopart

        message = self._update_summary()

        # loop through the disks and present them.
        for disk in self.disks:
            disk_info = self._format_disk_info(disk)
            c = CheckboxWidget(title="%i) %s" % (self.disks.index(disk) + 1, disk_info),
                               completed=(disk.name in self.selected_disks))
            self._window += [c, ""]

        # if we have more than one disk, present an option to just
        # select all disks
        if len(self.disks) > 1:
            c = CheckboxWidget(title="%i) %s" % (len(self.disks) + 1, _("Select all")),
                                completed=(self.selection == len(self.disks)))

            self._window += [c, ""]

        self._window += [TextWidget(message), ""]

        return True
    def __init__(self, app, data, storage, payload, instclass):
        """
        :see: pyanaconda.ui.tui.base.UIScreen
        :see: pyanaconda.ui.tui.base.App
        :param app: reference to application which is a main class for TUI
                    screen handling, it is responsible for mainloop control
                    and keeping track of the stack where all TUI screens are
                    scheduled
        :type app: instance of pyanaconda.ui.tui.base.App
        :param data: data object passed to every spoke to load/store data
                     from/to it
        :type data: pykickstart.base.BaseHandler
        :param storage: object storing storage-related information
                        (disks, partitioning, bootloader, etc.)
        :type storage: blivet.Blivet
        :param payload: object storing packaging-related information
        :type payload: pyanaconda.packaging.Payload
        :param instclass: distribution-specific information
        :type instclass: pyanaconda.installclass.BaseInstallClass

        """

        NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)

        self.done = False
示例#9
0
文件: user.py 项目: zhangsju/anaconda
    def __init__(self, data, storage, payload, instclass):
        FirstbootSpokeMixIn.__init__(self)
        NormalTUISpoke.__init__(self, data, storage, payload, instclass)

        self.initialize_start()

        self.title = N_("User creation")
        self._container = None

        if self.data.user.userList:
            self._user_data = self.data.user.userList[0]
            self._create_user = True
        else:
            self._user_data = self.data.UserData()
            self._create_user = False

        self._use_password = self._user_data.isCrypted or self._user_data.password
        self._groups = ""
        self._is_admin = False
        self._policy = self.data.anaconda.pwpolicy.get_policy("user", fallback_to_default=True)

        self.errors = []

        self._users_module = USERS.get_observer()
        self._users_module.connect()

        self.initialize_done()
    def refresh(self, args = None):
        NormalTUISpoke.refresh(self, args)

        # Join the initialization thread to block on it
        # This print is foul.  Need a better message display
        print(_("Probing storage..."))
        threadMgr.wait(THREAD_STORAGE_WATCHER)

        # synchronize our local data store with the global ksdata
        # Commment out because there is no way to select a disk right
        # now without putting it in ksdata.  Seems wrong?
        #self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.autopart = self.data.autopart.autopart

        message = self._update_summary()

        # loop through the disks and present them.
        for disk in self.disks:
            size = size_str(disk.size)
            c = CheckboxWidget(title="%i) %s: %s (%s)" % (self.disks.index(disk) + 1,
                                                 disk.model, size, disk.name),
                               completed=(disk.name in self.selected_disks))
            self._window += [c, ""]

        self._window += [TextWidget(message), ""]

        return True
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        summary = self._summary_text()
        self._window += [TextWidget(summary), ""]

        if self.data.timezone.timezone:
            timezone_option = _("Change timezone")
        else:
            timezone_option = _("Set timezone")

        _options = [timezone_option, _("Configure NTP servers")]
        text = [TextWidget(m) for m in _options]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # gnarl and mangle all of our widgets so things look pretty on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]

        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
示例#12
0
    def refresh(self, args=None):
        """
        args is None if we want a list of languages; or, it is a list of all
        locales for a language.
        """
        NormalTUISpoke.refresh(self, args)

        if args:
            self._window += [TextWidget(_("Available locales"))]
            displayed = [TextWidget(localization.get_english_name(z)) for z in args]
        else:
            self._window += [TextWidget(_("Available languages"))]
            displayed = [TextWidget(z) for z in self._langs]

        def _prep(i, w):
            """ make everything look nice """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # split zones to three columns
        middle = len(displayed) / 3
        left = [_prep(i, w) for i, w in enumerate(displayed) if i <= middle]
        center = [_prep(i, w) for i, w in enumerate(displayed) if i > middle and i <= 2*middle]
        right = [_prep(i, w) for i, w in enumerate(displayed) if i > 2*middle]

        c = ColumnWidget([(24, left), (24, center), (24, right)], 3)
        self._window += [c, ""]

        return True
    def refresh(self, args=None):
        """ Refresh screen. """
        NormalTUISpoke.refresh(self, args)

        environments = self.payload.environments

        displayed = []
        for env in environments:
            (name, desc) = self.payload.environmentDescription(env)

            displayed.append(CheckboxWidget(title="%s" % name, completed=(environments.index(env) == self._selection)))
        print(_("Choose a desktop environment."))

        def _prep(i, w):
            """ Do some format magic for display. """
            num = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [num]), (None, [w])], 1)

        # split list of DE's into two columns
        mid = len(environments) / 2
        left = [_prep(i, w) for i, w in enumerate(displayed) if i <= mid]
        right = [_prep(i, w) for i, w in enumerate(displayed) if i > mid]

        cw = ColumnWidget([(38, left), (38, right)], 2)
        self._window.append(cw)

        return True
示例#14
0
    def __init__(self, app, data, storage, payload, instclass, roots):
        NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)

        self._root = None
        self._roots = roots
        # default to selecting the first root in the list
        self._selection = 0
示例#15
0
    def refresh(self, args=None):
        """ Refresh screen. """
        NormalTUISpoke.refresh(self, args)

        self._container = ListColumnContainer(1, columns_width=78, spacing=1)

        if not self.nm_client:
            self.window.add_with_separator(TextWidget(_("Network configuration is not available.")))
            return

        summary = self._summary_text()
        self.window.add_with_separator(TextWidget(summary))

        hostname = _("Host Name: %s\n") % self._network_module.proxy.Hostname
        self.window.add_with_separator(TextWidget(hostname))
        current_hostname = _("Current host name: %s\n") % self._network_module.proxy.GetCurrentHostname()
        self.window.add_with_separator(TextWidget(current_hostname))

        # if we have any errors, display them
        while len(self.errors) > 0:
            self.window.add_with_separator(TextWidget(self.errors.pop()))

        dialog = Dialog(_("Host Name"))
        self._container.add(TextWidget(_("Set host name")), callback=self._set_hostname_callback, data=dialog)

        for device_configuration in self.editable_configurations:
            iface = device_configuration.device_name
            text = (_("Configure device %s") % iface)
            self._container.add(TextWidget(text), callback=self._ensure_connection_and_configure,
                                data=iface)

        self.window.add_with_separator(self._container)
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # check if the storage refresh thread is running
        if threadMgr.get(THREAD_STORAGE_WATCHER):
            # storage refresh is running - just report it
            # so that the user can refresh until it is done
            # TODO: refresh once the thread is done ?
            message = _(PAYLOAD_STATUS_PROBING_STORAGE)
            self._window += [TextWidget(message), ""]
            return True

        # check if there are any mountable devices
        if self._mountable_devices:
            def _prep(i, w):
                """ Mangle our text to make it look pretty on screen. """
                number = TextWidget("%2d)" % (i + 1))
                return ColumnWidget([(4, [number]), (None, [w])], 1)

            devices = [TextWidget(d[1]) for d in self._mountable_devices]

            # gnarl and mangle all of our widgets so things look pretty on
            # screen
            choices = [_prep(i, w) for i, w in enumerate(devices)]

            displayed = ColumnWidget([(78, choices)], 1)
            self._window.append(displayed)

        else:
            message = _("No mountable devices found")
            self._window += [TextWidget(message), ""]
        return True
示例#17
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)

        self._container = ListColumnContainer(1, columns_width=78, spacing=1)

        if self.data.method.method == "harddrive" and \
           get_mount_device(DRACUT_ISODIR) == get_mount_device(DRACUT_REPODIR):
            message = _("The installation source is in use by the installer and cannot be changed.")
            self.window.add_with_separator(TextWidget(message))
            return

        if args == self.SET_NETWORK_INSTALL_MODE:
            if self.payload.mirrors_available:
                self._container.add(TextWidget(_("Closest mirror")), self._set_network_close_mirror)
            self._container.add(TextWidget("http://"), self._set_network_url, SpecifyRepoSpoke.HTTP)
            self._container.add(TextWidget("https://"), self._set_network_url, SpecifyRepoSpoke.HTTPS)
            self._container.add(TextWidget("ftp://"), self._set_network_url, SpecifyRepoSpoke.FTP)
            self._container.add(TextWidget("nfs"), self._set_network_nfs)
        else:
            self.window.add(TextWidget(_("Choose an installation source type.")))
            self._container.add(TextWidget(_("CD/DVD")), self._set_cd_install_source)
            self._container.add(TextWidget(_("local ISO file")), self._set_iso_install_source)
            self._container.add(TextWidget(_("Network")), self._set_network_install_source)

            if self._hmc:
                self._container.add(TextWidget(_("SE/HMC")), self._set_hmc_install_source)

        self.window.add_with_separator(self._container)
示例#18
0
    def initialize(self):
        NormalTUISpoke.initialize(self)
        self.initialize_start()

        threadMgr.add(AnacondaThread(name=THREAD_SOURCE_WATCHER,
                                     target=self._initialize))
        payloadMgr.addListener(payloadMgr.STATE_ERROR, self._payload_error)
示例#19
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # Join the initialization thread to block on it
        # This print is foul.  Need a better message display
        print(_(PAYLOAD_STATUS_PROBING_STORAGE))
        threadMgr.wait(THREAD_STORAGE_WATCHER)

        # synchronize our local data store with the global ksdata
        # Commment out because there is no way to select a disk right
        # now without putting it in ksdata.  Seems wrong?
        #self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.autopart = self.data.autopart.autopart

        self._container = ListColumnContainer(1, spacing=1)

        message = self._update_summary()

        # loop through the disks and present them.
        for disk in self.disks:
            disk_info = self._format_disk_info(disk)
            c = CheckboxWidget(title=disk_info, completed=(disk.name in self.selected_disks))
            self._container.add(c, self._update_disk_list_callback, disk)

        # if we have more than one disk, present an option to just
        # select all disks
        if len(self.disks) > 1:
            c = CheckboxWidget(title=_("Select all"), completed=self.select_all)
            self._container.add(c, self._select_all_disks_callback)

        self.window.add_with_separator(self._container)
        self.window.add_with_separator(TextWidget(message))
示例#20
0
    def refresh(self, args=None):
        """args is None if we want a list of zones or "zone" to show all timezones in that zone."""
        NormalTUISpoke.refresh(self, args)

        if args and args in self._timezones:
            self._window += [TextWidget(_("Available timezones in region %s") % args)]
            displayed = [TextWidget(z) for z in self._timezones[args]]
        else:
            self._window += [TextWidget(_("Available regions"))]
            displayed = [TextWidget(z) for z in self._regions]

        def _prep(i, w):
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # split zones to three columns
        middle = len(displayed) / 3
        left = [_prep(i, w) for i, w in enumerate(displayed) if i <= middle]
        center = [_prep(i, w) for i, w in enumerate(displayed) if i > middle and i <= 2*middle]
        right = [_prep(i, w) for i, w in enumerate(displayed) if i > 2*middle]

        c = ColumnWidget([(24, left), (24, center), (24, right)], 3)
        self._window.append(c)

        return True
    def refresh(self, args=None):
        """ Refresh screen. """
        NormalTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)

        if not self.payload.baseRepo:
            message = TextWidget(_("Installation source needs to be set up first."))
            self._window.append(message)

            # add some more space below
            self._window.append(TextWidget(""))
            return True

        threadMgr.wait(THREAD_CHECK_SOFTWARE)
        displayed = []

        # Display the environments
        if args is None:
            environments = self.payload.environments
            length = len(environments)
            msg = _("Base environment")

            for env in environments:
                name = self.payload.environmentDescription(env)[0]
                selected = environments.index(env) == self._selection
                displayed.append(CheckboxWidget(title="%s" % name, completed=selected))

        # Display the add-ons
        else:
            length = len(args)

            if length > 0:
                msg = _("Add-ons for selected environment")
            else:
                msg = _("No add-ons to select.")

            for addon_id in args:
                name = self.payload.groupDescription(addon_id)[0]
                selected = addon_id in self._addons_selection
                displayed.append(CheckboxWidget(title="%s" % name, completed=selected))

        def _prep(i, w):
            """ Do some format magic for display. """
            num = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [num]), (None, [w])], 1)

        # split list of DE's into two columns
        mid = length / 2
        left = [_prep(i, w) for i, w in enumerate(displayed) if i <= mid]
        right = [_prep(i, w) for i, w in enumerate(displayed) if i > mid]

        cw = ColumnWidget([(38, left), (38, right)], 2)

        self._window.append(TextWidget(msg))
        self._window.append(TextWidget(""))
        self._window.append(cw)
        self._window.append(TextWidget(""))
        return True
示例#22
0
 def __init__(self, app, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.partschemes = OrderedDict()
     pre_select = self.data.autopart.type or DEFAULT_AUTOPART_TYPE
     for i, item in enumerate(AUTOPART_CHOICES):
         self.partschemes[item[0]] = item[1]
         if item[1] == pre_select:
             self._selection = i
示例#23
0
 def __init__(self, app, data, storage, payload, instclass, message=None):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self._password = ""
     if message:
         self._message = message
     else:
         self._message = _("Please provide VNC password. You will have to type it twice. \n"
                           "Leave blank for no password")
示例#24
0
    def initialize(self):
        self.initialize_start()
        self._load_new_devices()

        NormalTUISpoke.initialize(self)
        if not self._network_module.proxy.Kickstarted:
            self._update_network_data()
        self.initialize_done()
示例#25
0
 def __init__(self, app, data, storage, payload, instclass, message=None):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self._password = ""
     if message:
         self._message = message
     else:
         self._message = _("Please provide VNC password (must be six to eight characters long).\n"
                           "You will have to type it twice. Leave blank for no password")
 def __init__(self, app, data, storage, payload, instclass, device):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.selection = None
     self.args = self.data.method
     self._device = device
     self._mount_device()
     self._isos = self._getISOs()
示例#27
0
    def __init__(self, data, storage, payload, instclass, protocol):
        NormalTUISpoke.__init__(self, data, storage, payload, instclass)
        SourceSwitchHandler.__init__(self)
        self.title = N_("Specify Repo Options")
        self.protocol = protocol
        self._container = None

        self._url = self.data.url.url
示例#28
0
 def __init__(self, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.title = N_("Installation source")
     self._container = None
     self._ready = False
     self._error = False
     self._cdrom = None
     self._hmc = False
示例#29
0
 def __init__(self, data, storage, payload, instclass, device):
     NormalTUISpoke.__init__(self, data, storage, payload, instclass)
     SourceSwitchHandler.__init__(self)
     self.title = N_("Select an ISO to use as install source")
     self._container = None
     self.args = self.data.method
     self._device = device
     self._mount_device()
     self._isos = self._getISOs()
示例#30
0
    def initialize(self):
        NormalTUISpoke.initialize(self)

        for f in ["services", "protocols", "group", "man.config",
                  "nsswitch.conf", "selinux", "mke2fs.conf"]:
            try:
                os.symlink('/mnt/runtime/etc/' + f, '/etc/' + f)
            except OSError:
                pass
示例#31
0
 def __init__(self, app, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
示例#32
0
 def initialize(self):
     NormalTUISpoke.initialize(self)
     threadMgr.add(AnacondaThread(name=THREAD_SOFTWARE_WATCHER, target=self._initialize))
示例#33
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        if self._root:
            try:
                mount_existing_system(self.storage.fsset,
                                      self._root.device,
                                      read_only=self.readOnly)
                if flags.automatedInstall:
                    log.info("System has been mounted under: %s",
                             iutil.getSysroot())
                else:
                    text = TextWidget(
                        _("Your system has been mounted under %(mountpoint)s.\n\n"
                          "If you would like to make the root of your system the "
                          "root of the active system, run the command:\n\n"
                          "\tchroot %(mountpoint)s\n") %
                        {"mountpoint": iutil.getSysroot()})
                    self._window.append(text)
                rootmounted = True

                # now turn on swap
                if not flags.imageInstall or not self.readOnly:
                    try:
                        self.storage.turn_on_swap()
                    except StorageError:
                        log.error("Error enabling swap.")

                # turn on selinux also
                if flags.selinux:
                    # we have to catch the possible exception, because we
                    # support read-only mounting
                    try:
                        fd = open("%s/.autorelabel" % iutil.getSysroot(), "w+")
                        fd.close()
                    except IOError:
                        log.warning("Cannot touch %s/.autorelabel",
                                    iutil.getSysroot())

                # set a libpath to use mounted fs
                libdirs = os.environ.get("LD_LIBRARY_PATH", "").split(":")
                mounted = list(
                    map(lambda dir: "/mnt/sysimage%s" % dir, libdirs))
                iutil.setenv("LD_LIBRARY_PATH", ":".join(libdirs + mounted))

                # do we have bash?
                try:
                    if os.access("/usr/bin/bash", os.R_OK):
                        os.symlink("/usr/bin/bash", "/bin/bash")
                except OSError:
                    pass
            except (ValueError, LookupError, SyntaxError, NameError):
                pass
            except (OSError, StorageError) as e:
                if flags.automatedInstall:
                    msg = _(
                        "Run %s to unmount the system when you are finished.\n"
                    ) % ANACONDA_CLEANUP

                text = TextWidget(
                    _("An error occurred trying to mount some or all of "
                      "your system.  Some of it may be mounted under %s\n\n") +
                    iutil.getSysroot() + msg)
                self._window.append(text)
                return True
        else:
            if flags.automatedInstall and self.data.reboot.action in [
                    KS_REBOOT, KS_SHUTDOWN
            ]:
                log.info("No Linux partitions found.")
                text = TextWidget(
                    _("You don't have any Linux partitions.  Rebooting.\n"))
                self._window.append(text)
                # should probably wait a few seconds to show the message
                time.sleep(5)
                iutil.execWithRedirect("systemctl", ["--no-wall", "reboot"])
            else:
                if not flags.imageInstall:
                    msg = _(
                        "The system will reboot automatically when you exit"
                        " from the shell.\n")
                else:
                    msg = ""
            text = TextWidget(
                _("You don't have any Linux partitions. %s\n") % msg)
            self._window.append(text)
            return True

        if rootmounted and not self.readOnly:
            self.storage.make_mtab()
            try:
                makeResolvConf(iutil.getSysroot())
            except (OSError, IOError) as e:
                log.error("Error making resolv.conf: %s", e)
            text = TextWidget(
                _("Your system is mounted under the %s directory.") %
                iutil.getSysroot())
            self._window.append(text)

        # create /etc/fstab in ramdisk so it's easier to work with RO mounted fs
        makeFStab()

        # run %post if we've mounted everything
        if rootmounted and not self.readOnly and flags.automatedInstall:
            runPostScripts(self.data.scripts)

        return True
示例#34
0
    def should_run(cls, environment, data):
        """Don't run for any non-package payload."""
        if not NormalTUISpoke.should_run(environment, data):
            return False

        return context.payload_type == PAYLOAD_TYPE_DNF
示例#35
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        self._window += [TextWidget(_("Exit the shell to continue")), ""]
示例#36
0
 def __init__(self, app, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self._currentISOFile = None
     self._mountable_devices = self._get_mountable_devices()
     self._device = None
示例#37
0
 def __init__(self, app, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.partschemes = OrderedDict([("Standard Partition",
                                      AUTOPART_TYPE_PLAIN),
                                     ("LVM", AUTOPART_TYPE_LVM),
                                     ("BTRFS", AUTOPART_TYPE_BTRFS)])
示例#38
0
 def __init__(self, app, data, storage, payload, instclass):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self.clearPartType = self.data.clearpart.type
     self.parttypelist = sorted(PARTTYPES.keys())
示例#39
0
 def initialize(self):
     self.initialize_start()
     NormalTUISpoke.initialize(self)
     self._update_editable_configurations()
     self._network_module.DeviceConfigurationChanged.connect(self._device_configurations_changed)
     self.initialize_done()
示例#40
0
    def refresh(self, args = None):
        NormalTUISpoke.refresh(self, args)
        self._window += [TextWidget(self._message), ""]

        return True
示例#41
0
    def should_run(cls, environment, data):
        """Don't run the storage spoke on dir installations."""
        if not NormalTUISpoke.should_run(environment, data):
            return False

        return not conf.target.is_directory
 def prompt(self, args=None):
     """ Customize default prompt. """
     prompt = NormalTUISpoke.prompt(self, args)
     prompt.set_message(_("Please select language support to install"))
     prompt.add_option(PROMPT_BACK_KEY, _(PROMPT_BACK_DESCRIPTION))
     return prompt
示例#43
0
 def input(self, args, key):
     if self._container.process_user_input(key):
         self.apply()
         return InputState.PROCESSED_AND_REDRAW
     else:
         return NormalTUISpoke.input(self, args, key)
示例#44
0
    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        msg = _(
            "Please select new root password. You will have to type it twice.")
        self.window.add_with_separator(TextWidget(msg))
示例#45
0
 def refresh(self, args=None):
     NormalTUISpoke.refresh(self, args)
     self.window.add_with_separator(TextWidget(self._message))
示例#46
0
 def __init__(self, app, data, storage, payload, instclass, time_spoke):
     NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
     self._time_spoke = time_spoke
示例#47
0
 def __init__(self, data, storage, payload, instclass, timezone_spoke):
     NormalTUISpoke.__init__(self, data, storage, payload, instclass)
     self.title = N_("Select an NTP server to remove")
     self._time_spoke = timezone_spoke
     self._ntp_server_index = None
示例#48
0
 def refresh(self, args=None):
     NormalTUISpoke.refresh(self, args)
     summary = self._summary_text()
     self.window.add_with_separator(TextWidget(summary))
示例#49
0
 def show_all(self):
     NormalTUISpoke.show_all(self)
     # if we have any errors, display them
     while self.errors:
         print(self.errors.pop())
示例#50
0
 def __init__(self, data, storage, payload, instclass, time_spoke):
     NormalTUISpoke.__init__(self, data, storage, payload, instclass)
     self.title = N_("NTP configuration")
     self._container = None
     self._time_spoke = time_spoke