index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-04-22 08:56:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 08:56:45 +0000 |
commit | 1f6094ea594785cae105d34b8c0e4bbc6fb71927 (patch) | |
tree | 5776556a59e80516a9ac5362de62813b6396b0a6 | |
parent | 752d7b7a8d28dff0c40d7fada823d94c92fcd195 (diff) | |
parent | e6ab22f28cc71daa87286d7262c07fa45ab628d7 (diff) |
-rw-r--r-- | archinstall/lib/installer.py | 20 | ||||
-rw-r--r-- | archinstall/lib/user_interaction.py | 14 | ||||
-rw-r--r-- | examples/guided.py | 19 |
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2f90560f..f6c891a3 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -39,7 +39,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages='base base-devel linux linux-firmware efibootmgr'): + def __init__(self, target, *, base_packages='base base-devel linux linux-firmware'): self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) @@ -48,8 +48,12 @@ class Installer(): 'base' : False, 'bootloader' : False } - + self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages + if hasUEFI(): + self.base_packages.append("efibootmgr") + else: + self.base_packages.append("grub") self.post_base_install = [] storage['session'] = self @@ -425,15 +429,17 @@ class Installer(): elif bootloader == "grub-install": if hasUEFI(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) - sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') + sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') + return True else: - root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{root_partition.path.strip("/dev/")}/..")', shell=True).decode().strip() + root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/","")}/..)"', shell=True).decode().strip() if root_device == "block": root_device = f"{root_partition.path}" - o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=--target=i386-pc /dev/{root_device}')) - sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') + 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') + return True else: - raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") + raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}") def add_additional_packages(self, *packages): return self.pacstrap(*packages) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 822f63be..70ff7a1e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,7 +7,7 @@ from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces from .general import sys_command -from .hardware import AVAILABLE_GFX_DRIVERS +from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -143,7 +143,17 @@ def ask_for_a_timezone(): level=LOG_LEVELS.Warning, fg='red' ) - + +def ask_for_bootloader() -> str: + bootloader = "systemd-bootctl" + if hasUEFI()==False: + bootloader="grub-install" + else: + bootloader_choice = input("Would you like to use GRUB as a bootloader instead of systemd-boot? [y/N] ").lower() + if bootloader_choice == "y": + bootloader="grub-install" + return bootloader + def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() diff --git a/examples/guided.py b/examples/guided.py index c86f2b4b..878412a9 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -64,6 +64,7 @@ def ask_user_questions(): partition_mountpoints[partition] = None except archinstall.UnknownFilesystemFormat as err: archinstall.log(f" {partition} (Filesystem not supported)", fg='red') + # We then ask what to do with the partitions. if (option := archinstall.ask_for_disk_layout()) == 'abort': @@ -141,7 +142,7 @@ def ask_user_questions(): if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')): archinstall.arguments['!encryption-password'] = passwd archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password'] - + archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader() # Get the hostname for the machine if not archinstall.arguments.get('hostname', None): archinstall.arguments['hostname'] = input('Desired hostname for the installation: ').strip(' ') @@ -190,7 +191,7 @@ def ask_user_questions(): # Additional packages (with some light weight error handling for invalid package names) while True: if not archinstall.arguments.get('packages', None): - print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.") + print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr (on UEFI systems)/GRUB (on BIOS systems) 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.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] @@ -266,8 +267,8 @@ def perform_installation_steps(): partition.format() else: archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug) - - fs.find_partition('/boot').format('vfat') + if hasUEFI(): + fs.find_partition('/boot').format('vfat')# we don't have a boot partition in bios mode if archinstall.arguments.get('!encryption-password', None): # First encrypt and unlock, then format the desired partition inside the encrypted part. @@ -279,8 +280,8 @@ def perform_installation_steps(): else: fs.find_partition('/').format(fs.find_partition('/').filesystem) fs.find_partition('/').mount('/mnt') - - fs.find_partition('/boot').mount('/mnt/boot') + if hasUEFI(): + fs.find_partition('/boot').mount('/mnt/boot') perform_installation('/mnt') @@ -299,17 +300,17 @@ def perform_installation(mountpoint): installation.log(f'Waiting for automatic mirror selection (reflector) to complete.', level=archinstall.LOG_LEVELS.Info) while archinstall.service_state('reflector') not in ('dead', 'failed'): time.sleep(1) - # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium - if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) if archinstall.arguments['mirror-region'].get("mirrors",{})!= None: installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium + if archinstall.arguments["bootloader"]=="grub-install" and hasUEFI()==True: + installation.add_additional_packages("grub") installation.set_keyboard_language(archinstall.arguments['keyboard-language']) - installation.add_bootloader() + installation.add_bootloader(archinstall.arguments["bootloader"]) # If user selected to copy the current ISO network configuration # Perform a copy of the config |