From 7afba65c261057808fae8e3cb22ddd89fed31f2b Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 18:43:19 +0530 Subject: rebase --- archinstall/lib/user_interaction.py | 14 ++++++++++++-- examples/guided.py | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 822f63be..9d09d8f1 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 over 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..643e2c94 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -64,6 +64,8 @@ def ask_user_questions(): partition_mountpoints[partition] = None except archinstall.UnknownFilesystemFormat as err: archinstall.log(f" {partition} (Filesystem not supported)", fg='red') + + archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader() # We then ask what to do with the partitions. if (option := archinstall.ask_for_disk_layout()) == 'abort': @@ -190,7 +192,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(in uefi 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)] @@ -303,7 +305,8 @@ def perform_installation(mountpoint): # 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 hasUEFI()==False: + installation.base_packages.replace("efibootmgr","")# if we aren't on a uefi system why install efibootmgr if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) if archinstall.arguments['mirror-region'].get("mirrors",{})!= None: -- cgit v1.2.3-70-g09d2 From 9c400aa7272fc8eb5c34b19fd65e0f3ed6cb01f5 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 18:49:02 +0530 Subject: reworked how we handle bootloaders a little --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 643e2c94..408f377a 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -307,12 +307,14 @@ def perform_installation(mountpoint): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if hasUEFI()==False: installation.base_packages.replace("efibootmgr","")# if we aren't on a uefi system why install efibootmgr + if archinstall.arguments["bootloader"] == "grub-install": + installation.base_packages = installation.base_packages + " grub" 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 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 -- cgit v1.2.3-70-g09d2 From 23704b7908798ff0328daa0fe90d3299806c50e3 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 18:53:47 +0530 Subject: repharsed some stuff --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 408f377a..7e36f0b2 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -192,7 +192,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(in uefi systems) 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)] -- cgit v1.2.3-70-g09d2 From 7872d5b7facf07510bbe27789c7a2f6b5381673f Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:23:18 +0530 Subject: rebase clean up --- profiles/budgie.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/profiles/budgie.py b/profiles/budgie.py index 1f224209..6c5475ae 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -1,13 +1,7 @@ -<<<<<<< HEAD:profiles/cinnamon.py -# A desktop environment using "Cinnamon" -import archinstall - -======= # A desktop environment using "budgie" import archinstall ->>>>>>> master:profiles/budgie.py is_top_level_profile = False def _prep_function(*args, **kwargs): @@ -18,11 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ -<<<<<<< HEAD:profiles/cinnamon.py - # Cinnamon requires a functioning Xorg installation. -======= # budgie requires a functioning Xorg installation. ->>>>>>> master:profiles/budgie.py profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): @@ -31,17 +21,6 @@ def _prep_function(*args, **kwargs): print('Deprecated (??): xorg profile has no _prep_function() anymore') # Ensures that this code only gets executed if executed -<<<<<<< HEAD:profiles/cinnamon.py -# through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") -# or through conventional import cinnamon -if __name__ == 'cinnamon': - # Install dependency profiles - installation.install_profile('xorg') - - # Install the application cinnamon from the template under /applications/ - cinnamon = archinstall.Application(installation, 'cinnamon') - cinnamon.install() -======= # through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") # or through conventional import budgie if __name__ == 'budgie': @@ -51,6 +30,5 @@ if __name__ == 'budgie': # Install the application budgie from the template under /applications/ budgie = archinstall.Application(installation, 'budgie') budgie.install() ->>>>>>> master:profiles/budgie.py installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From 1ea02a7e692af2f3db16308b14be2ccdacdcb761 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:27:16 +0530 Subject: we should only look for boot on uefi systems --- examples/guided.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 7e36f0b2..df9c9c37 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -268,8 +268,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. -- cgit v1.2.3-70-g09d2 From fc8960f2a9a9dd15185f8c4f7d9d98463663637c Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:35:28 +0530 Subject: we should only look for boot on uefi systems --- examples/guided.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index df9c9c37..5007fd33 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -268,8 +268,7 @@ 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) - if hasUEFI(): - fs.find_partition('/boot').format('vfat')# we don't have a boot partition in bios mode + 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. @@ -281,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') -- cgit v1.2.3-70-g09d2 From 572ab522fc829a972b6c51774c0e04cc99590fad Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:40:09 +0530 Subject: we should only look for boot on uefi systems --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 5007fd33..7af77642 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -268,7 +268,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')# we don't have a boot partition in bios mode + 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. -- cgit v1.2.3-70-g09d2 From dbb6d630bdfdb655a3567b8cebc5c6b82bb74459 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:43:23 +0530 Subject: fixed some issues with adding packages --- examples/guided.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 7af77642..015cc19d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -306,9 +306,9 @@ def perform_installation(mountpoint): if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if hasUEFI()==False: - installation.base_packages.replace("efibootmgr","")# if we aren't on a uefi system why install efibootmgr + installation.base_packages.pop(installation.base_packages.index("efibootmgr"))# if we aren't on a uefi system why install efibootmgr if archinstall.arguments["bootloader"] == "grub-install": - installation.base_packages = installation.base_packages + " grub" + installation.base_packages = installation.base_packages.append("grub") if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) if archinstall.arguments['mirror-region'].get("mirrors",{})!= None: -- cgit v1.2.3-70-g09d2 From 47202d9bf94941659946470615a8c6e013e4643e Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:46:22 +0530 Subject: moved some stuff --- examples/guided.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 015cc19d..02a39e8c 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -65,7 +65,6 @@ def ask_user_questions(): except archinstall.UnknownFilesystemFormat as err: archinstall.log(f" {partition} (Filesystem not supported)", fg='red') - archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader() # We then ask what to do with the partitions. if (option := archinstall.ask_for_disk_layout()) == 'abort': @@ -143,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(' ') -- cgit v1.2.3-70-g09d2 From 264db25eefd09a99ecdfa5f095b49343fc143d82 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:50:12 +0530 Subject: call hasUEFI --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 9d09d8f1..818590dd 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -146,7 +146,7 @@ def ask_for_a_timezone(): def ask_for_bootloader() -> str: bootloader = "systemd-bootctl" - if hasUEFI==False: + if hasUEFI()==False: bootloader="grub-install" else: bootloader_choice = input("Would you like to use Grub as a bootloader over systemd-boot [y/N] ").lower() -- cgit v1.2.3-70-g09d2 From adeae68123314742dd76e2e231400c5cf6237c1e Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:58:23 +0530 Subject: reworked how we remove efimanager and add grub --- archinstall/lib/installer.py | 3 ++- examples/guided.py | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2f90560f..4cf658c1 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -48,7 +48,8 @@ class Installer(): 'base' : False, 'bootloader' : False } - + if hasUEFI() == False: + base_packages.replace(" efibootmgr","") self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages self.post_base_install = [] diff --git a/examples/guided.py b/examples/guided.py index 02a39e8c..8308d22c 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -300,18 +300,15 @@ 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 hasUEFI()==False: - installation.base_packages.pop(installation.base_packages.index("efibootmgr"))# if we aren't on a uefi system why install efibootmgr - if archinstall.arguments["bootloader"] == "grub-install": - installation.base_packages = installation.base_packages.append("grub") 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": + installation.add_additional_packages("grub") installation.set_keyboard_language(archinstall.arguments['keyboard-language']) installation.add_bootloader(archinstall.arguments["bootloader"]) -- cgit v1.2.3-70-g09d2 From 64a785e0ec302daca8372205106a0990574bda9e Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 20:01:15 +0530 Subject: reworked how we remove efimanager --- archinstall/lib/installer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 4cf658c1..10532296 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -48,9 +48,10 @@ class Installer(): 'base' : False, 'bootloader' : False } - if hasUEFI() == False: - base_packages.replace(" efibootmgr","") + self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages + if hasUEFI() == False: + self.base_packages.pop(self.base_packages.index("efibootmgr")) self.post_base_install = [] storage['session'] = self -- cgit v1.2.3-70-g09d2 From 4a9f56ed2d8dba0e116467857305d1992761588c Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 20:26:19 +0530 Subject: fixed shell command in add bootloader --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 10532296..e74501c6 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -429,7 +429,7 @@ class Installer(): 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') 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}')) -- cgit v1.2.3-70-g09d2 From 8b723c25e2c487c508d2718b06381ca6c2b7d2a0 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 20:36:26 +0530 Subject: changed some strings --- archinstall/lib/user_interaction.py | 2 +- examples/guided.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 818590dd..175079ee 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -149,7 +149,7 @@ def ask_for_bootloader() -> str: if hasUEFI()==False: bootloader="grub-install" else: - bootloader_choice = input("Would you like to use Grub as a bootloader over systemd-boot [y/N] ").lower() + bootloader_choice = input("Would you like to use GRUB as a bootloader instead off systemd-boot [y/N] ").lower() if bootloader_choice == "y": bootloader="grub-install" return bootloader diff --git a/examples/guided.py b/examples/guided.py index 8308d22c..3d357e2d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -191,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(on uefi systems)/grub(on bios systems) 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)] -- cgit v1.2.3-70-g09d2 From b4312ab95df579e395da55d8018934a492812faf Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 20:46:49 +0530 Subject: removed unnessacry --target --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index e74501c6..9b56ad92 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -432,7 +432,7 @@ class Installer(): 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}')) + 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 grub-mkconfig -o /boot/grub/grub.cfg') else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-70-g09d2 From e2444de5a218645b880707d9d1adc3b0387474b2 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 21:06:31 +0530 Subject: added /mnt to grubcfg genration --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 9b56ad92..e81e4c45 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -427,13 +427,13 @@ 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') else: 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=i386-pc /dev/{root_device}')) - 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') else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-70-g09d2 From 85a8215eb7fbe7e5a73c6cf557701e319cf4a089 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 21:06:57 +0530 Subject: fixed some weird grammer --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index e81e4c45..7b1a673d 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -435,7 +435,7 @@ class Installer(): 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') 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) -- cgit v1.2.3-70-g09d2 From a02c35920d7d2f984e1e962c3c7a7556df148e13 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 21:21:17 +0530 Subject: added return true --- archinstall/lib/installer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7b1a673d..10a9ad4b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -428,12 +428,14 @@ class Installer(): 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 /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.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=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 requested: {bootloader}") -- cgit v1.2.3-70-g09d2 From 85c5275a8f35a7a0c0713d76c68ae0a127f1421c Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 21:23:11 +0530 Subject: added return true --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 3d357e2d..878412a9 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -307,7 +307,7 @@ def perform_installation(mountpoint): 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": + 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(archinstall.arguments["bootloader"]) -- cgit v1.2.3-70-g09d2 From a694daec5d938b41b33164e49e83d764ef7ef6f7 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 22:09:27 +0530 Subject: some more grammer fixes --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 175079ee..70ff7a1e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -149,7 +149,7 @@ def ask_for_bootloader() -> str: if hasUEFI()==False: bootloader="grub-install" else: - bootloader_choice = input("Would you like to use GRUB as a bootloader instead off systemd-boot [y/N] ").lower() + 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 -- cgit v1.2.3-70-g09d2 From 63a94a57708bdfb4cdfde0c24af2d324ba191beb Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 22:09:27 +0530 Subject: add efibootmgr only on uefi systems --- archinstall/lib/installer.py | 8 +++++--- archinstall/lib/user_interaction.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 10a9ad4b..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]) @@ -50,8 +50,10 @@ class Installer(): } self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages - if hasUEFI() == False: - self.base_packages.pop(self.base_packages.index("efibootmgr")) + if hasUEFI(): + self.base_packages.append("efibootmgr") + else: + self.base_packages.append("grub") self.post_base_install = [] storage['session'] = self diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 175079ee..70ff7a1e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -149,7 +149,7 @@ def ask_for_bootloader() -> str: if hasUEFI()==False: bootloader="grub-install" else: - bootloader_choice = input("Would you like to use GRUB as a bootloader instead off systemd-boot [y/N] ").lower() + 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 -- cgit v1.2.3-70-g09d2