From bd9d2c9125aa7e08d38093dcf21fcef3d101f4d6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 22 Apr 2021 15:18:59 -0400 Subject: Update user_interaction.py --- archinstall/lib/user_interaction.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 77b3d771..a481dac3 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -130,17 +130,19 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan return users, super_users def ask_for_a_timezone(): - timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() - if timezone == '': - timezone = 'UTC' - if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists(): - return timezone - else: - log( - f"Time zone {timezone} does not exist, continuing with system default.", - level=LOG_LEVELS.Warning, - fg='red' - ) + exists = False + while not exists: + timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() + if timezone == '': + timezone = 'UTC' + if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists(): + return timezone + else: + log( + f"Specified timezone {timezone} does not exist.", + level=LOG_LEVELS.Warning, + fg='red' + ) def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments -- cgit v1.2.3-70-g09d2 From 74951b841c9906511731408bc5d3a70a7d6ae65f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 22 Apr 2021 21:36:31 +0200 Subject: Restructured endless loop definition I prefer to easily spot an endless loop by not having external variables attached to the loop condition. Since we never updated `exists` it's a dummy variable that I expect to be updated some where in order to break it. When that's not the case, it's more clear that it's an endless loop if there's no conditions attached to the loop definition. --- archinstall/lib/user_interaction.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index a481dac3..dcb51e2a 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -130,8 +130,7 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan return users, super_users def ask_for_a_timezone(): - exists = False - while not exists: + while True: timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() if timezone == '': timezone = 'UTC' -- cgit v1.2.3-70-g09d2 From 81c57560b3f2f0cd10dd8d6b360266f9f4622a41 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 22 Apr 2021 21:56:52 +0200 Subject: Fixes #324. --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index ef447abb..09638f0e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -74,13 +74,14 @@ def ask_user_questions(): archinstall.log(f" ** You will now select which partitions to use by selecting mount points (inside the installation). **") archinstall.log(f" ** The root would be a simple / and the boot partition /boot (as all paths are relative inside the installation). **") + mountpoints_set = [] while True: # Select a partition # If we provide keys as options, it's better to convert them to list and sort before passing mountpoints_list = sorted(list(partition_mountpoints.keys())) partition = archinstall.generic_select(mountpoints_list, "Select a partition by number that you want to set a mount-point for (leave blank when done): ") - if not partition: + if not partition and set(mountpoints_set) & {'/', '/boot'} == {'/', '/boot'}: break # Select a mount-point @@ -122,6 +123,7 @@ def ask_user_questions(): # We can safely mark the partition for formatting and where to mount it. # TODO: allow_formatting might be redundant since target_mountpoint should only be # set if we actually want to format it anyway. + mountpoints_set.append(mountpoint) partition.allow_formatting = True partition.target_mountpoint = mountpoint # Only overwrite the filesystem definition if we selected one: -- cgit v1.2.3-70-g09d2 From 3cf8ec7ad6eccd2899ded1f80ae31c2f835c4d8f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 22 Apr 2021 21:58:47 +0200 Subject: Added a continuation if partitions are not set yet. --- examples/guided.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 09638f0e..2bf911fc 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -81,8 +81,11 @@ def ask_user_questions(): mountpoints_list = sorted(list(partition_mountpoints.keys())) partition = archinstall.generic_select(mountpoints_list, "Select a partition by number that you want to set a mount-point for (leave blank when done): ") - if not partition and set(mountpoints_set) & {'/', '/boot'} == {'/', '/boot'}: - break + if not partition: + if set(mountpoints_set) & {'/', '/boot'} == {'/', '/boot'}: + break + + continue # Select a mount-point mountpoint = input(f"Enter a mount-point for {partition}: ").strip(' ') -- cgit v1.2.3-70-g09d2 From 91fa98f48dc7c232d10bf501a133151db826cf34 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 22 Apr 2021 17:49:58 -0400 Subject: While somewhat nice to have, archlinux-wallpaper isn't needed in a minimal installation. --- profiles/applications/lxqt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py index 5ce875cc..2099f3fa 100644 --- a/profiles/applications/lxqt.py +++ b/profiles/applications/lxqt.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock archlinux-wallpaper sddm") +installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock sddm") -- cgit v1.2.3-70-g09d2 From 95e73f65a7ea41c49ba2186124517d52dd962eb8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 22 Apr 2021 19:36:32 -0400 Subject: Ignore dotfiles and globs --- 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 dcb51e2a..b1437382 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -134,7 +134,7 @@ def ask_for_a_timezone(): timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() if timezone == '': timezone = 'UTC' - if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists(): + if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone.strip('*.')).exists(): return timezone else: log( -- cgit v1.2.3-70-g09d2 From d21e31d4779593bd371ef0a301f4dc0a4d79cc1f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 22 Apr 2021 19:38:43 -0400 Subject: Actually, putting it here makes more sense. --- archinstall/lib/user_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b1437382..89c54f78 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -131,10 +131,10 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan def ask_for_a_timezone(): while True: - timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() + timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip().strip('*.') if timezone == '': timezone = 'UTC' - if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone.strip('*.')).exists(): + if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists(): return timezone else: log( -- cgit v1.2.3-70-g09d2 From 84dbbd0857253cd2e954c2f8951ce426b53a6037 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 23 Apr 2021 23:52:49 +0200 Subject: Added back the note about using /mnt as is Also added a "experimental" warning to it. --- archinstall/lib/user_interaction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index dcb51e2a..5d857b93 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -320,10 +320,13 @@ def select_disk(dict_o_disks): if len(drives) >= 1: for index, drive in enumerate(drives): print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})") - drive = generic_select(drives, 'Select one of the above disks (by number or full path) or leave blank to skip partitioning: ', + + log(f"You can skip selecting a drive and partition it and use whatever drive-setup is mounted at /mnt (experimental)", fg="yellow") + drive = generic_select(drives, 'Select one of the above disks (by name or number) or leave blank to use /mnt: ', options_output=False) if not drive: return drive + drive = dict_o_disks[drive] return drive -- cgit v1.2.3-70-g09d2