Esempio n. 1
0
def _prep_function(*args, **kwargs):
    """
	Magic function called by the importing installer
	before continuing any further.
	"""
    selected_servers = archinstall.generic_multi_select(
        available_servers,
        f"Choose which servers to install and enable (leave blank for a minimal installation): "
    )
    archinstall.storage['_selected_servers'] = selected_servers

    return True
Esempio n. 2
0
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
Esempio n. 3
0
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'])