index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/installer.py | 14 | ||||
-rw-r--r-- | archinstall/lib/user_interaction.py | 23 | ||||
-rw-r--r-- | examples/guided.py | 11 | ||||
-rw-r--r-- | profiles/sway.py | 3 | ||||
-rw-r--r-- | profiles/xorg.py | 9 |
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 577a2ae1..a5449662 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1,6 +1,5 @@ import os, stat, time, shutil, pathlib import subprocess, logging - from .exceptions import * from .disk import * from .general import * @@ -40,8 +39,8 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages='base base-devel linux linux-firmware', kernels='linux'): - base_packages = base_packages + kernels.replace(',', ' ') + def __init__(self, target, *, base_packages='base base-devel linux-firmware', kernels='linux'): + kernels = kernels.split(",") self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) @@ -52,6 +51,8 @@ class Installer(): } self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages + for kernel in kernels: + self.base_packages.append(kernel) if hasUEFI(): self.base_packages.append("efibootmgr") else: @@ -363,8 +364,10 @@ class Installer(): boot_partition = partition elif partition.mountpoint == self.target: root_partition = partition - - self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=logging.INFO) + if hasUEFI(): + self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=logging.INFO) + else: + self.log(f'Adding bootloader {bootloader} to {root_partition}', level=logging.INFO) if bootloader == 'systemd-bootctl': if not hasUEFI(): @@ -439,6 +442,7 @@ class Installer(): root_device = f"{root_partition.path}" o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}')) sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') + self.helper_flags['bootloader'] = bootloader return True else: raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}") diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index cd848136..d08d7e25 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -506,3 +506,26 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver raise RequirementError("Selecting drivers require a least one profile to be given as an option.") + +def select_kernel(options): + """ + Asks the user to select a kernel for system. + + :param options: A `list` with kernel options + :type options: list + + :return: The string as a selected kernel + :rtype: string + """ + + DEFAULT_KERNEL = "linux" + + kernels = sorted(list(options)) + + if kernels: + selected_kernels = generic_select(kernels, f"Choose which kernel to use (leave blank for default: {DEFAULT_KERNEL}): ") + if not selected_kernels: + return DEFAULT_KERNEL + return selected_kernels + + raise RequirementError("Selecting kernels require a least one kernel to be given as an option.") diff --git a/examples/guided.py b/examples/guided.py index 1ff84907..2b8a06f5 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -2,7 +2,6 @@ import getpass, time, json, os, logging import archinstall from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile -from archinstall.lib.user_interaction import generic_select if archinstall.arguments.get('help'): print("See `man archinstall` for help.") @@ -195,14 +194,10 @@ def ask_user_questions(): # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues archinstall.arguments['audio'] = None - # Ask what kernel user wants: + # Ask for preferred kernel: if not archinstall.arguments.get("kernels", None): - archinstall.log(f"Here you can choose which kernel to use, leave blank for default which is 'linux'.") - - if (kernel := generic_select(["linux", "linux-lts", "linux-zen", "continue"], "choose a kernel:")): - archinstall.arguments['kernels'] = kernel - else: - archinstall.arguments['kernels'] = 'linux' + 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.") diff --git a/profiles/sway.py b/profiles/sway.py index 53eb8c5a..f132df33 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,7 +11,8 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - + if "nvidia" in _gfx_driver_packages: + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers") __builtins__['_gfx_driver_packages'] = archinstall.select_driver() return True diff --git a/profiles/xorg.py b/profiles/xorg.py index 413a6308..cd89668d 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -25,7 +25,14 @@ def _prep_function(*args, **kwargs): # or through conventional import xorg if __name__ == 'xorg': try: - installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + if "nvidia" in _gfx_driver_packages: + if "linux-zen" in installation.base_packages or "linux-lts" in installation.base_packages: + installation.add_additional_packages("dkms")#I've had kernel regen fail if it wasn't installed before nvidia-dkms + installation.add_additional_packages("xorg-server xorg-xinit nvidia-dkms") + else: + installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + else: + installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") except: installation.add_additional_packages(f"xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install |