示例#1
0
    # Ask about audio server selection if one is not already set
    if not archinstall.arguments.get('audio', None):
        # only ask for audio server selection on a desktop profile
        if str(archinstall.arguments['profile']) == 'Profile(desktop)':
            archinstall.arguments[
                'audio'] = archinstall.ask_for_audio_selection()
        else:
            # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that.
            # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues
            archinstall.arguments['audio'] = None

    # Ask for preferred kernel:
    if not archinstall.arguments.get("kernels", None):
        kernels = ["linux", "linux-lts", "linux-zen", "linux-hardened"]
        archinstall.arguments['kernels'] = archinstall.select_kernel(kernels)

    # Additional packages (with some light weight error handling for invalid package names)
    print(
        "Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed."
    )
    print(
        "If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt."
    )
    while True:
        if not archinstall.arguments.get('packages', None):
            archinstall.arguments['packages'] = [
                package for package in input(
                    'Write additional packages to install (space separated, leave blank to skip): '
                ).split(' ') if len(package)
            ]
 def _setup_selection_menu_options(self):
     self._menu_options['keyboard-layout'] = \
      Selector('Select keyboard layout', lambda: archinstall.select_language('us'), default='us')
     self._menu_options['mirror-region'] = \
      Selector(
       'Select mirror region',
       lambda: archinstall.select_mirror_regions(),
       display_func=lambda x: list(x.keys()) if x else '[]',
       default={})
     self._menu_options['sys-language'] = \
      Selector('Select locale language', lambda: archinstall.select_locale_lang('en_US'), default='en_US')
     self._menu_options['sys-encoding'] = \
      Selector('Select locale encoding', lambda: archinstall.select_locale_enc('utf-8'), default='utf-8')
     self._menu_options['harddrives'] = \
      Selector(
       'Select harddrives',
       lambda: self._select_harddrives())
     self._menu_options['disk_layouts'] = \
      Selector(
       'Select disk layout',
       lambda: archinstall.select_disk_layout(
        archinstall.arguments['harddrives'],
        archinstall.arguments.get('advanced', False)
       ),
       dependencies=['harddrives'])
     self._menu_options['!encryption-password'] = \
      Selector(
       'Set encryption password',
       lambda: archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): '),
       display_func=lambda x: self._secret(x) if x else 'None',
       dependencies=['harddrives'])
     self._menu_options['swap'] = \
      Selector(
       'Use swap',
       lambda: archinstall.ask_for_swap(),
       default=True)
     self._menu_options['bootloader'] = \
      Selector(
       'Select bootloader',
       lambda: archinstall.ask_for_bootloader(archinstall.arguments.get('advanced', False)),)
     self._menu_options['hostname'] = \
      Selector('Specify hostname', lambda: archinstall.ask_hostname())
     self._menu_options['!root-password'] = \
      Selector(
       'Set root password',
       lambda: self._set_root_password(),
       display_func=lambda x: self._secret(x) if x else 'None')
     self._menu_options['!superusers'] = \
      Selector(
       'Specify superuser account',
       lambda: self._create_superuser_account(),
       dependencies_not=['!root-password'],
       display_func=lambda x: list(x.keys()) if x else '')
     self._menu_options['!users'] = \
      Selector(
       'Specify user account',
       lambda: self._create_user_account(),
       default={},
       display_func=lambda x: list(x.keys()) if x else '[]')
     self._menu_options['profile'] = \
      Selector(
       'Specify profile',
       lambda: self._select_profile(),
       display_func=lambda x: x if x else 'None')
     self._menu_options['audio'] = \
      Selector(
       'Select audio',
       lambda: archinstall.ask_for_audio_selection(archinstall.is_desktop_profile(archinstall.arguments.get('profile', None))))
     self._menu_options['kernels'] = \
      Selector(
       'Select kernels',
       lambda: archinstall.select_kernel(),
       default='linux')
     self._menu_options['packages'] = \
      Selector(
       'Additional packages to install',
       lambda: archinstall.ask_additional_packages_to_install(archinstall.arguments.get('packages', None)),
       default=[])
     self._menu_options['nic'] = \
      Selector(
       'Configure network',
       lambda: archinstall.ask_to_configure_network(),
       display_func=lambda x: x if x else 'Not configured, unavailable unless setup manually',
       default={})
     self._menu_options['timezone'] = \
      Selector('Select timezone', lambda: archinstall.ask_for_a_timezone())
     self._menu_options['ntp'] = \
      Selector(
       'Set automatic time sync (NTP)',
       lambda: archinstall.ask_ntp(),
       default=True)
     self._menu_options['install'] = \
      Selector(
       self._install_text(),
       enabled=True)
     self._menu_options['abort'] = Selector('Abort', enabled=True)