def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. Not until we're satisfied with what we want to install will we continue with the actual installation steps. """ if not archinstall.arguments.get('keyboard-layout', None): while True: try: archinstall.arguments['keyboard-layout'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip() break except archinstall.RequirementError as err: archinstall.log(err, fg="red") # Before continuing, set the preferred keyboard layout/language in the current terminal. # This will just help the user with the next following questions. if len(archinstall.arguments['keyboard-layout']): archinstall.set_keyboard_language(archinstall.arguments['keyboard-layout']) # Set which region to download packages from during the installation if not archinstall.arguments.get('mirror-region', None): while True: try: archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) break except archinstall.RequirementError as e: archinstall.log(e, fg="red") if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False): archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip() archinstall.arguments['sys-encoding'] = input("Enter a valid system default encoding for your OS, (Default: utf-8): ").strip() archinstall.log("Keep in mind that if you want multiple locales, post configuration is required.", fg="yellow") if not archinstall.arguments.get('sys-language', None): archinstall.arguments['sys-language'] = 'en_US' if not archinstall.arguments.get('sys-encoding', None): archinstall.arguments['sys-encoding'] = 'utf-8' # Ask which harddrives/block-devices we will install to # and convert them into archinstall.BlockDevice() objects. if archinstall.arguments.get('harddrives', None) is None: _prompt = "Select one or more harddrives to use and configure (leave blank to skip this step): " archinstall.arguments['harddrives'] = archinstall.generic_multi_select(archinstall.all_disks(), text=_prompt, allow_empty=True) if archinstall.arguments.get('harddrives', None) is not None and archinstall.storage.get('disk_layouts', None) is None: archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False)) # Get disk encryption password (or skip if blank) if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None: if passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): '): archinstall.arguments['!encryption-password'] = passwd
def ask_harddrives(): # Ask which harddrives/block-devices we will install to # and convert them into archinstall.BlockDevice() objects. if archinstall.arguments.get('harddrives', None) is None: archinstall.arguments['harddrives'] = archinstall.generic_multi_select( archinstall.all_disks(), text= "Select one or more harddrives to use and configure (leave blank to skip this step): ", allow_empty=True) if not archinstall.arguments['harddrives']: archinstall.log("You decided to skip harddrive selection", fg="red", level=logging.INFO) archinstall.log( f"and will use whatever drive-setup is mounted at {archinstall.storage['MOUNT_POINT']} (experimental)", fg="red", level=logging.INFO) archinstall.log( "WARNING: Archinstall won't check the suitability of this setup", fg="red", level=logging.INFO) if input("Do you wish to continue ? [Y/n]").strip().lower() == 'n': exit(1) else: if archinstall.storage.get('disk_layouts', None) is None: archinstall.storage[ 'disk_layouts'] = archinstall.select_disk_layout( archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False)) # Get disk encryption password (or skip if blank) if archinstall.arguments.get('!encryption-password', None) is None: if passwd := archinstall.get_password( prompt= 'Enter disk encryption password (leave blank for no encryption): ' ): archinstall.arguments['!encryption-password'] = passwd if archinstall.arguments.get('!encryption-password', None): # If no partitions was marked as encrypted, but a password was supplied and we have some disks to format.. # Then we need to identify which partitions to encrypt. This will default to / (root). if len( list( archinstall.encrypted_partitions( archinstall.storage['disk_layouts']))) == 0: archinstall.storage[ 'disk_layouts'] = archinstall.select_encrypted_partitions( archinstall.storage['disk_layouts'], archinstall.arguments['!encryption-password'])
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)