From ae33151b9b1549eed36071e24c34170ac6009988 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 12 Apr 2021 14:51:32 +0200 Subject: Moving warning about UEFI to guided for now. --- examples/guided.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index beb577c8..0025abc1 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -3,6 +3,10 @@ import archinstall from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile +if hasUEFI() is False: + log("Archinstall currently only support UEFI booted machines. MBR & GRUB is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error) + exit(1) + def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. -- cgit v1.2.3-54-g00ecf From 3034def365a0f139a41b20c8933e61e86f298eaf Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Mon, 12 Apr 2021 10:09:37 -0400 Subject: Move logic to guided --- archinstall/lib/installer.py | 11 ++++------- examples/guided.py | 8 ++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7c3ee051..c50b2ac7 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -81,13 +81,7 @@ class Installer(): if not (missing_steps := self.post_install_check()): self.log('Installation completed without any errors. You may now reboot.', bg='black', fg='green', level=LOG_LEVELS.Info) self.sync_log_to_install_medium() - self.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") - choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ") - if choice.lower() in ("y", ""): - try: - subprocess.check_call(f"arch-chroot {self.target}", shell=True) - except: - pass + return True else: self.log('Some required steps were not successfully installed/configured before leaving the installer:', bg='black', fg='red', level=LOG_LEVELS.Warning) @@ -197,6 +191,9 @@ class Installer(): def arch_chroot(self, cmd, *args, **kwargs): return self.run_command(cmd) + def drop_to_shell(self): + subprocess.check_call(f"/usr/bin/arch-chroot {self.target}", shell=True) + def configure_nic(self, nic, dhcp=True, ip=None, gateway=None, dns=None, *args, **kwargs): if dhcp: conf = Networkd(Match={"Name": nic}, Network={"DHCP": "yes"}) diff --git a/examples/guided.py b/examples/guided.py index beb577c8..d50063f3 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -327,3 +327,11 @@ def perform_installation(mountpoint): ask_user_questions() perform_installation_steps() + +installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") +choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ") +if choice.lower() in ("y", ""): + try: + installation.drop_to_shell() + except: + pass -- cgit v1.2.3-54-g00ecf From 67b05d8fb13c5a417d063ead1f8add6c0f15c226 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 10:01:54 +0200 Subject: Added option to not touch mirror-list. Example if archlinux.org times out, use the existing mirror-list without trying to overwrite it. --- archinstall/lib/user_interaction.py | 2 +- examples/guided.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3d9a468b..de5813bb 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -402,4 +402,4 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): return selected_mirrors - raise RequirementError("Selecting mirror region require a least one region to be given as an option.") + return None diff --git a/examples/guided.py b/examples/guided.py index 7353b7a7..7223ebbe 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -281,10 +281,12 @@ def perform_installation(mountpoint): while 'dead' not in (status := archinstall.service_state('reflector')): time.sleep(1) - archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium + 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']) - installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium + if archinstall.arguments.get('mirror-region', 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() -- cgit v1.2.3-54-g00ecf From 311426cbc22d72fd3d858ef1580b5d6d1f6b5665 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 10:27:33 +0200 Subject: Fixing a logic issue with ask_to_configure_network(). It no longer returns None if skipped, it returns a dict so that we can do sub-level logic checks in guided. --- archinstall/lib/user_interaction.py | 2 +- examples/guided.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index de5813bb..99cf6274 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -186,7 +186,7 @@ def ask_to_configure_network(): elif nic: return nic - return None + return {} def ask_for_disk_layout(): options = { diff --git a/examples/guided.py b/examples/guided.py index 7223ebbe..b4a3a7f7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -292,13 +292,13 @@ def perform_installation(mountpoint): # If user selected to copy the current ISO network configuration # Perform a copy of the config - if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': + if archinstall.arguments.get('nic', {}) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('nic',{}).get('NetworkManager',False): + elif archinstall.arguments.get('nic', {}).get('NetworkManager',False): installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface - elif archinstall.arguments.get('nic', None): + elif archinstall.arguments.get('nic', {}): installation.configure_nic(**archinstall.arguments.get('nic', {})) installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') -- cgit v1.2.3-54-g00ecf From 342dbb4ebf5f95306a68c8a2e75f7abe6111f358 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 10:56:22 +0200 Subject: Added a Info level to the reflector wait in case it's slow. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index b4a3a7f7..d274545c 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -277,7 +277,7 @@ def perform_installation(mountpoint): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist # We need to wait for it before we continue since we opted in to use a custom mirror/region. - installation.log(f'Waiting for automatic mirror selection has completed before using custom mirrors.') + installation.log(f'Waiting for automatic mirror selection (feflector) to complete.', level=archinstall.LOG_LEVELS.Info) while 'dead' not in (status := archinstall.service_state('reflector')): time.sleep(1) -- cgit v1.2.3-54-g00ecf From 9295f38134aa4683a95e2a1a2a081694eda76c98 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 11:02:45 +0200 Subject: Added two comments. --- examples/guided.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index d274545c..7d8877bd 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -281,12 +281,17 @@ def perform_installation(mountpoint): while 'dead' not in (status := archinstall.service_state('reflector')): 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']) + + # Configure the selected mirrors in the installation if archinstall.arguments.get('mirror-region', 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() -- cgit v1.2.3-54-g00ecf From 4d7c787cfda56b300f4a0e47db668d2148d6593a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 12:47:17 +0200 Subject: Fixing reflector waiting state. It can be dead which means it's done, or failed it systemd failed to start/find it. --- examples/guided.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 7d8877bd..c2dba3db 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -278,7 +278,7 @@ def perform_installation(mountpoint): # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist # We need to wait for it before we continue since we opted in to use a custom mirror/region. installation.log(f'Waiting for automatic mirror selection (feflector) to complete.', level=archinstall.LOG_LEVELS.Info) - while 'dead' not in (status := archinstall.service_state('reflector')): + while archinstall.service_state('reflector') not in ('dead', 'failed'): time.sleep(1) # Set mirrors used by pacstrap (outside of installation) @@ -287,11 +287,11 @@ def perform_installation(mountpoint): if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) - + # Configure the selected mirrors in the installation if archinstall.arguments.get('mirror-region', 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() -- cgit v1.2.3-54-g00ecf From 4750b0b2a1ca3a65d96136074735d995d5417b5a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 12:56:50 +0200 Subject: Fixed a spelling error. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index c2dba3db..368bc5b3 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -277,7 +277,7 @@ def perform_installation(mountpoint): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist # We need to wait for it before we continue since we opted in to use a custom mirror/region. - installation.log(f'Waiting for automatic mirror selection (feflector) to complete.', level=archinstall.LOG_LEVELS.Info) + 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) -- cgit v1.2.3-54-g00ecf From 516402cac48a618f019ad99e1cf77f9e180bdf7b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 13 Apr 2021 13:54:23 +0200 Subject: Moved the '.drop_to_shell()' into the with installation context so we don't loose 'installation'. --- examples/guided.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 368bc5b3..29bbadca 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -335,14 +335,14 @@ def perform_installation(mountpoint): if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): installation.user_set_pw('root', root_pw) + installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") + choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ") + if choice.lower() in ("y", ""): + try: + installation.drop_to_shell() + except: + pass ask_user_questions() perform_installation_steps() -installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") -choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ") -if choice.lower() in ("y", ""): - try: - installation.drop_to_shell() - except: - pass -- cgit v1.2.3-54-g00ecf From 0617292340bfca722336fc9e73a129d397d1e157 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 13 Apr 2021 18:41:23 +0530 Subject: better prompts for audio servers --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index a43e78ab..00ebb24e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -302,13 +302,15 @@ def perform_installation(mountpoint): installation.enable_service('systemd-resolved') if archinstall.arguments.get('audio', None) != None: - installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) + installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) elif archinstall.arguments.get('audio', None) == 'pulseaudio': print('Installing pulseaudio ...') installation.add_additional_packages("pulseaudio") + else: + installation.log("No audio server will be installed.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) -- cgit v1.2.3-54-g00ecf From 37fae922533d06d5e54078f2ad0d74d013bbeb2e Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 13 Apr 2021 18:45:55 +0530 Subject: set archinstall.arguments['audio']=None --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 00ebb24e..8797b87e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -175,7 +175,7 @@ def ask_user_questions(): else: # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that. # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues - archinstall.arguments['audio'] = 'none' + archinstall.arguments['audio'] = None # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): -- cgit v1.2.3-54-g00ecf From dffb611d18a9de5695297dee7c97e7cc4e97c0c6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 13 Apr 2021 20:19:46 -0400 Subject: Fix warning on BIOS/MBR systems --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index d47a949c..fa644480 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -4,7 +4,7 @@ from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile if hasUEFI() is False: - log("ArchInstall currently only supports machines booted with UEFI. MBR & GRUB support is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error) + archinstall.log("ArchInstall currently only supports machines booted with UEFI.\nMBR & GRUB support is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error) exit(1) def ask_user_questions(): -- cgit v1.2.3-54-g00ecf From 3347d04bfa8daef042cc51af24e996b111374a66 Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 13:46:47 +0530 Subject: fixed issues raised in a review --- archinstall/lib/user_interaction.py | 27 +++++++++++++-------------- examples/guided.py | 23 ++++++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'examples/guided.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 16627794..6756fb50 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -345,6 +345,7 @@ def select_language(options, show_only_country_codes=True): elif selected_language.isdigit() and (pos := int(selected_language)) <= len(languages)-1: selected_language = languages[pos] + return select_language # I'm leaving "options" on purpose here. # Since languages possibly contains a filtered version of # all possible language layouts, and we might want to write @@ -352,9 +353,9 @@ def select_language(options, show_only_country_codes=True): # go through the search step. elif selected_language in options: selected_language = options[options.index(selected_language)] + return selected_language else: - RequirementError("Selected language does not exist.") - return selected_language + print("Invalid Langue please select a valid option.") raise RequirementError("Selecting languages require a least one language to be given as an option.") @@ -383,21 +384,19 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): print(' -- You can skip this step by leaving the option blank --') selected_mirror = input('Select one of the above regions to download packages from (by number or full name): ') if len(selected_mirror.strip()) == 0: - return {} - - elif selected_mirror.isdigit() and (pos := int(selected_mirror)) <= len(regions)-1: + return {"mirror": None} + + elif selected_mirror.isdigit() and int(selected_mirror) <= len(regions)-1: + # I'm leaving "mirrors" on purpose here. + # Since region possibly contains a known region of + # all possible regions, and we might want to write + # for instance Sweden (if we know that exists) without having to + # go through the search step. region = regions[int(selected_mirror)] selected_mirrors[region] = mirrors[region] - # I'm leaving "mirrors" on purpose here. - # Since region possibly contains a known region of - # all possible regions, and we might want to write - # for instance Sweden (if we know that exists) without having to - # go through the search step. elif selected_mirror in mirrors: selected_mirrors[selected_mirror] = mirrors[selected_mirror] else: - RequirementError("Selected region does not exist.") - - return selected_mirrors + print("Selected region does not exist.") - raise RequirementError("Selecting mirror region require a least one region to be given as an option.") + return selected_mirrors \ No newline at end of file diff --git a/examples/guided.py b/examples/guided.py index 8797b87e..6d81a680 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -23,7 +23,8 @@ def ask_user_questions(): # Set which region to download packages from during the installation if not archinstall.arguments.get('mirror-region', None): - archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) + while archinstall.arguments.get("mirror-region",{}) == {}: + archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) else: selected_region = archinstall.arguments['mirror-region'] archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]} @@ -184,13 +185,16 @@ def ask_user_questions(): archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] if len(archinstall.arguments['packages']): - # Verify packages that were given - try: - archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") - archinstall.validate_package_list(archinstall.arguments['packages']) - except archinstall.RequirementError as e: - archinstall.log(e, fg='red') - exit(1) + invalid_packages = True + while invalid_packages == True: + # Verify packages that were given + try: + archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") + archinstall.validate_package_list(archinstall.arguments['packages']) + invalid_packages = False + except archinstall.RequirementError as e: + archinstall.log(e, fg='red') + invalid_packages = True # Ask or Call the helper function that asks the user to optionally configure a network. if not archinstall.arguments.get('nic', None): @@ -284,7 +288,8 @@ def perform_installation(mountpoint): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) - installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium + if archinstall.arguments['mirror-region'] != 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() -- cgit v1.2.3-54-g00ecf From 85bcc589510db63412f11afdf7cae54e9bedd772 Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 14:16:11 +0530 Subject: missed a merge --- examples/guided.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index e45868ef..1af57fd6 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -291,16 +291,8 @@ def perform_installation(mountpoint): if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) -<<<<<<< HEAD if archinstall.arguments['mirror-region'] != None: installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium -======= - - # Configure the selected mirrors in the installation - if archinstall.arguments.get('mirror-region', None): - installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium - ->>>>>>> af2671c1ec1ac2ecbdbd35c90c3e5016dcf516ed installation.set_keyboard_language(archinstall.arguments['keyboard-language']) installation.add_bootloader() -- cgit v1.2.3-54-g00ecf From 78a9f0077e570e2f6ca4afed7f7153510522b10e Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 14:21:53 +0530 Subject: fixed line 249 --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 1af57fd6..6b8a36df 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -291,7 +291,7 @@ def perform_installation(mountpoint): if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) - if archinstall.arguments['mirror-region'] != None: + if archinstall.arguments['mirror-region'].get("mirror",None)!= 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() -- cgit v1.2.3-54-g00ecf From b08b2f3062eae00e8ac4eab613d4edec07b324ad Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 14:29:46 +0530 Subject: another patch for line 249 --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 6b8a36df..53dc1f09 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -291,7 +291,7 @@ def perform_installation(mountpoint): if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) - if archinstall.arguments['mirror-region'].get("mirror",None)!= None: + 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() -- cgit v1.2.3-54-g00ecf From c13c109bfff31d2035cad103c16fc74ebdbd4abf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 11:16:31 +0200 Subject: Removed a \t --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 53dc1f09..e0644540 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -309,7 +309,7 @@ def perform_installation(mountpoint): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - if archinstall.arguments.get('audio', None) != None: + if archinstall.arguments.get('audio', None) != None: installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') -- cgit v1.2.3-54-g00ecf From df3f7af91b28c3df75e9be8f2a961a408f3e5dbb Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 14:47:57 +0530 Subject: reworked mirror selection --- examples/guided.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 53dc1f09..8be47b82 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,3 +1,4 @@ +from archinstall.lib.exceptions import RequirementError import getpass, time, json, os import archinstall from archinstall.lib.hardware import hasUEFI @@ -23,8 +24,12 @@ def ask_user_questions(): # Set which region to download packages from during the installation if not archinstall.arguments.get('mirror-region', None): - while archinstall.arguments.get("mirror-region",{}) == {}: - archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) + valid_mirror = False + while valid_mirror == False: + try: + archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) + except RequirementError as e: + archinstall.log(e, fg="yellow") else: selected_region = archinstall.arguments['mirror-region'] archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]} -- cgit v1.2.3-54-g00ecf From 7ae4b170b38b98d71dc9825c11cff2afb8644d21 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 11:53:31 +0200 Subject: Removed excessive import The exceptions are already exposed in `archinstall.`. This might change in the future tho. --- examples/guided.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 37d15b25..7ba787f4 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,3 @@ -from archinstall.lib.exceptions import RequirementError import getpass, time, json, os import archinstall from archinstall.lib.hardware import hasUEFI @@ -28,7 +27,7 @@ def ask_user_questions(): while valid_mirror == False: try: archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) - except RequirementError as e: + except archinstall.RequirementError as e: archinstall.log(e, fg="yellow") else: selected_region = archinstall.arguments['mirror-region'] -- cgit v1.2.3-54-g00ecf From 99fb1304ea4bcf2744b06abdd4b747b686aaeef4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 12:06:15 +0200 Subject: Updated the loop logic for packages It wouldn't loop over the question again, so correct for that. --- examples/guided.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 7ba787f4..fc7ddeb6 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -183,22 +183,24 @@ def ask_user_questions(): archinstall.arguments['audio'] = None # Additional packages (with some light weight error handling for invalid package names) - if not archinstall.arguments.get('packages', None): - print("Packages not part of the desktop environment are not installed by default.") - 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)] - - if len(archinstall.arguments['packages']): - invalid_packages = True - while invalid_packages == True: + 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("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)] + + if len(archinstall.arguments['packages']): # Verify packages that were given try: archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") archinstall.validate_package_list(archinstall.arguments['packages']) - invalid_packages = False + break except archinstall.RequirementError as e: archinstall.log(e, fg='red') - invalid_packages = True + archinstall.arguments['packages'] = None # Clear the packages to trigger a new input question + else: + # no additional packages were selected, which we'll allow + break # Ask or Call the helper function that asks the user to optionally configure a network. if not archinstall.arguments.get('nic', None): -- cgit v1.2.3-54-g00ecf From 5b3a1221414a60676eb8622d033a6fadc1661411 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 12:08:37 +0200 Subject: Updated the loop logic for mirrors It wouldn't break out of the loop since the `valid_mirror` variable was never changed. --- examples/guided.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index fc7ddeb6..8a16f561 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -23,12 +23,12 @@ def ask_user_questions(): # Set which region to download packages from during the installation if not archinstall.arguments.get('mirror-region', None): - valid_mirror = False - while valid_mirror == False: + while True: try: archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors()) + break except archinstall.RequirementError as e: - archinstall.log(e, fg="yellow") + archinstall.log(e, fg="red") else: selected_region = archinstall.arguments['mirror-region'] archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]} -- cgit v1.2.3-54-g00ecf From 1aadfa98c4b4073dc4ad204297739c995213afae Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 12:46:18 +0200 Subject: Added a safety net to language selection --- examples/guided.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 8a16f561..c0d22023 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -14,7 +14,12 @@ def ask_user_questions(): will we continue with the actual installation steps. """ if not archinstall.arguments.get('keyboard-language', None): - archinstall.arguments['keyboard-language'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip() + while True: + try: + archinstall.arguments['keyboard-language'] = 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. -- cgit v1.2.3-54-g00ecf