示例#1
0
def perform_installation(mountpoint, mode):
	"""
	Performs the installation steps on a block device.
	Only requirement is that the block devices are
	formatted and setup prior to entering this function.
	"""
	with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', ['linux'])) as installation:
		if mode in ('full','only_hd'):
			disk_setup(installation)
			if mode == 'only_hd':
				target = pathlib.Path(f"{mountpoint}/etc/fstab")
				if not target.parent.exists():
					target.parent.mkdir(parents=True)

		if mode in ('full','only_os'):
			os_setup(installation)
			installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow")
			if not archinstall.arguments.get('silent'):
				prompt = 'Would you like to chroot into the newly created installation and perform post-installation configuration?'
				choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes()).run()
				if choice == Menu.yes():
					try:
						installation.drop_to_shell()
					except:
						pass

	# For support reasons, we'll log the disk layout post installation (crash or no crash)
	archinstall.log(f"Disk states after installing: {archinstall.disk_layouts()}", level=logging.DEBUG)
示例#2
0
def select_activate_NTP():
	prompt = "Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: "
	choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes()).run()
	if choice == Menu.yes():
		return True
	else:
		return False
示例#3
0
def _check_driver() -> bool:
    packages = archinstall.storage.get("gfx_driver_packages", [])

    if packages and "nvidia" in packages:
        prompt = 'The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues, are you okay with that?'
        choice = Menu(prompt,
                      Menu.yes_no(),
                      default_option=Menu.no(),
                      skip=False).run()

        if choice.value == Menu.no():
            return False

    return True
示例#4
0
def _prep_function(*args, **kwargs) -> bool:
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""
    choice = Menu(str(_('Select your desired desktop environment')),
                  __supported__).run()

    if choice.type_ != MenuSelectionType.Selection:
        return False

    if choice.value:
        # Temporarily store the selected desktop profile
        # in a session-safe location, since this module will get reloaded
        # the next time it gets executed.
        if not archinstall.storage.get('_desktop_profile', None):
            archinstall.storage['_desktop_profile'] = choice.value
        if not archinstall.arguments.get('desktop-environment', None):
            archinstall.arguments['desktop-environment'] = choice.value
        profile = archinstall.Profile(None, choice.value)
        # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
        with profile.load_instructions(
                namespace=f"{choice.value}.py") as imported:
            if hasattr(imported, '_prep_function'):
                return imported._prep_function()
            else:
                log(f"Deprecated (??): {choice.value} profile has no _prep_function() anymore"
                    )
                exit(1)

    return False
示例#5
0
def _prep_function(*args, **kwargs):
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    supported_configurations = ['i3-wm', 'i3-gaps']

    choice = Menu('Select your desired configuration',
                  supported_configurations).run()

    if choice.type_ != MenuSelectionType.Selection:
        return False

    if choice.value:
        # Temporarily store the selected desktop profile
        # in a session-safe location, since this module will get reloaded
        # the next time it gets executed.
        archinstall.storage['_i3_configuration'] = choice.value

        # i3 requires a functioning Xorg installation.
        profile = archinstall.Profile(None, 'xorg')
        with profile.load_instructions(namespace='xorg.py') as imported:
            if hasattr(imported, '_prep_function'):
                return imported._prep_function()
            else:
                print(
                    'Deprecated (??): xorg profile has no _prep_function() anymore'
                )

    return False
    def run(self):
        while True:
            # # Before continuing, set the preferred keyboard layout/language in the current terminal.
            # # This will just help the user with the next following questions.
            self._set_kb_language()

            enabled_menus = self._menus_to_enable()
            menu_text = [m.text for m in enabled_menus.values()]
            selection = Menu('Set/Modify the below options',
                             menu_text,
                             sort=False).run()
            if selection:
                selection = selection.strip()
                if 'Abort' in selection:
                    exit(0)
                elif 'Install' in selection:
                    if self._missing_configs() == 0:
                        self._post_processing()
                        break
                else:
                    self._process_selection(selection)
示例#7
0
def _prep_function(*args, **kwargs):
    """
	Magic function called by the importing installer
	before continuing any further.
	"""
    choice = Menu(str(
        _('Choose which servers to install, if none then a minimal installation wil be done'
          )),
                  available_servers,
                  preset_values=kwargs['servers'],
                  multi=True).run()

    if choice.type_ != MenuSelectionType.Selection:
        return False

    if choice.value:
        archinstall.storage['_selected_servers'] = choice.value
        return True

    return False
    def _select_harddrives(self):
        old_haddrives = archinstall.arguments.get('harddrives')
        harddrives = archinstall.select_harddrives()

        # in case the harddrives got changed we have to reset the disk layout as well
        if old_haddrives != harddrives:
            self._menu_options.get('disk_layouts').set_current_selection(None)
            archinstall.arguments['disk_layouts'] = {}

        if not harddrives:
            prompt = 'You decided to skip harddrive selection\n'
            prompt += f"and will use whatever drive-setup is mounted at {archinstall.storage['MOUNT_POINT']} (experimental)\n"
            prompt += "WARNING: Archinstall won't check the suitability of this setup\n"

            prompt += 'Do you wish to continue?'
            choice = Menu(prompt, ['yes', 'no'], default_option='yes').run()

            if choice == 'no':
                return self._select_harddrives()

        return harddrives
示例#9
0
        if archinstall.arguments.get('services', None):
            installation.enable_service(*archinstall.arguments['services'])

        # If the user provided custom commands to be run post-installation, execute them now.
        if archinstall.arguments.get('custom-commands', None):
            archinstall.run_custom_user_commands(
                archinstall.arguments['custom-commands'], installation)

        installation.log(
            "For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation",
            fg="yellow")
        if not archinstall.arguments.get('silent'):
            prompt = str(
                _('Would you like to chroot into the newly created installation and perform post-installation configuration?'
                  ))
            choice = Menu(prompt, Menu.yes_no(),
                          default_option=Menu.yes()).run()
            if choice == Menu.yes():
                try:
                    installation.drop_to_shell()
                except:
                    pass

    # For support reasons, we'll log the disk layout post installation (crash or no crash)
    archinstall.log(
        f"Disk states after installing: {archinstall.disk_layouts()}",
        level=logging.DEBUG)


if not (archinstall.check_mirror_reachable()
        or archinstall.arguments.get('skip-mirror-check', False)):
    log_file = os.path.join(archinstall.storage.get('LOG_PATH', None),