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 --- examples/guided.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'examples') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2 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') 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-70-g09d2