コード例 #1
0
    def create_available_linux_menu(self):
        linux_flavors = {"linux":"Generic", "linux-esx":"VMware hypervisor optimized", "linux-aws":"AWS optimized", "linux-secure":"Security hardened", "linux-rt":"Real Time"}

        self.menu_items = []
        for flavor,menu_entry in linux_flavors.items():
            if flavor in self.install_config['packages']:
                if flavor == "linux-esx" and not CommandUtils.is_vmware_virtualization():
                    continue
                self.menu_items.append((menu_entry, self.set_linux_installation, flavor))

        if len(self.menu_items) == 1:
            self.install_config['linux_flavor'] = self.menu_items[0][2]

        self.host_menu = Menu(self.menu_starty, self.maxx, self.menu_items,
                              default_selected=0, tab_enable=False)

        self.window = Window(self.win_height, self.win_width, self.maxy, self.maxx,
                             'Select Linux kernel to install', True, tab_enabled=False,
                             position=1, can_go_next=True)
        self.window.set_action_panel(self.host_menu)
コード例 #2
0
ファイル: iso_config.py プロジェクト: ali-hassan/photon
    def add_ui_pages(self, install_config, ui_config, maxy, maxx):
        items = []
        license_agreement = License(maxy, maxx)
        select_disk = SelectDisk(maxy, maxx, install_config)
        custom_partition = CustomPartition(maxy, maxx, install_config)
        package_selector = PackageSelector(maxy, maxx, install_config, ui_config['options_file'])
        hostname_reader = WindowStringReader(
            maxy, maxx, 10, 70,
            'hostname',
            None, # confirmation error msg if it's a confirmation text
            None, # echo char
            self.hostname_accepted_chars, # set of accepted chars
            IsoConfig.validate_hostname, # validation function of the input
            None, # post processing of the input field
            'Choose the hostname for your system', 'Hostname:', 2, install_config,
            self.random_hostname,
            True)
        root_password_reader = WindowStringReader(
            maxy, maxx, 10, 70,
            'shadow_password',
            None, # confirmation error msg if it's a confirmation text
            '*', # echo char
            None, # set of accepted chars
            IsoConfig.validate_password, # validation function of the input
            None,  # post processing of the input field
            'Set up root password', 'Root password:'******'shadow_password',
            # confirmation error msg if it's a confirmation text
            "Passwords don't match, please try again.",
            '*', # echo char
            None, # set of accepted chars
            None, # validation function of the input
            CommandUtils.generate_password_hash, # post processing of the input field
            'Confirm root password', 'Confirm Root password:'******'repo_url',
            None, # confirmation error msg if it's a confirmation text
            None, # echo char
            None, # set of accepted chars
            IsoConfig.validate_ostree_url_input, # validation function of the input
            None, # post processing of the input field
            'Please provide the URL of OSTree repo', 'OSTree Repo URL:', 2, install_config,
            "http://")
        ostree_ref_reader = OSTreeWindowStringReader(
            maxy, maxx, 10, 70,
            'repo_ref',
            None, # confirmation error msg if it's a confirmation text
            None, # echo char
            None, # set of accepted chars
            IsoConfig.validate_ostree_refs_input, # validation function of the input
            None, # post processing of the input field
            'Please provide the Refspec in OSTree repo', 'OSTree Repo Refspec:', 2, install_config,
            "photon/3.0/x86_64/minimal")
        confirm_window = ConfirmWindow(11, 60, maxy, maxx,
                                      (maxy - 11) // 2 + 7,
                                      'Start installation? All data on the selected disk will be lost.\n\n'
                                      'Press <Yes> to confirm, or <No> to quit')

        # This represents the installer screens, the bool indicated if
        # I can go back to this window or not
        items.append((license_agreement.display, False))
        items.append((select_disk.display, True))
        items.append((custom_partition.display, False))
        items.append((package_selector.display, True))
        if 'network_screen' in ui_config:
            allow_vlan = ui_config['network_screen'].get('allow_vlan', False)
            net_cfg = NetworkConfigure(maxy, maxx, install_config, allow_vlan)
            items.append((net_cfg.display, True))

        if 'download_screen' in ui_config:
            title = ui_config['download_screen'].get('title', None)
            intro = ui_config['download_screen'].get('intro', None)
            dest  = ui_config['download_screen'].get('destination', None)
            fd = FileDownloader(maxy, maxx, install_config, title, intro, dest, True)
            items.append((fd.display, True))

        if CommandUtils.is_vmware_virtualization():
            linux_selector = LinuxSelector(maxy, maxx, install_config)
            items.append((linux_selector.display, True))
        items.append((hostname_reader.get_user_string, True))
        items.append((root_password_reader.get_user_string, True))
        items.append((confirm_password_reader.get_user_string, False))
        items.append((ostree_server_selector.display, True))
        items.append((ostree_url_reader.get_user_string, True))
        items.append((ostree_ref_reader.get_user_string, True))
        items.append((confirm_window.do_action, True))

        return items