Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction
diff options
context:
space:
mode:
authorAbhay Mohandas <80393938+abhay-mohandas@users.noreply.github.com>2022-08-09 23:45:49 +0530
committerGitHub <noreply@github.com>2022-08-09 20:15:49 +0200
commit6213560a0543b11eb007020b044255edaf009d4b (patch)
tree302f43d7fcdc6a538d23aaa6d503d4931644658d /archinstall/lib/user_interaction
parent3e10fc106b27c70593147b1c8aef1be221106d75 (diff)
Fixes for known issues in the Parallel Download option (#1403)
* Adding menu * Working on parallel downloads * error updates * updates * update * Few more updates * bug fixes * More bug fixes * Minor bug fixes * Few changes * Minor changes * Cleaned up add_number_of_parrallel_downloads() and hid it behind --advanced * Forgot one import * Fixed flake8 * Bug fixes * I'm trying... * trying again * trying even more * Bug fixes * Fixed known issues * Code improvements * Few fixes * Minor changes * Minor changes * Trying to fix flake8 Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/user_interaction')
-rw-r--r--archinstall/lib/user_interaction/general_conf.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index 44147afa..a121f368 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -206,15 +206,25 @@ def ask_additional_packages_to_install(pre_set_packages: List[str] = []) -> List
return packages
-def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:
- print(_("Enter the number of parallel downloads to be enabled.\n [Default value is 0]"))
- while input_number is None:
+def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:
+ max_downloads = 5
+ print(_(f"This option enables the number of parallel downloads that can occur during installation"))
+ print(_(f"Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {max_downloads})\nNote:"))
+ print(_(f" - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )"))
+ print(_(f" - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )"))
+ print(_(f" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )"))
+
+ while True:
try:
- input_number = int(TextInput("> ").run().strip() or 0)
+ input_number = int(TextInput("[Default value: 0] > ").run().strip() or 0)
+ if input_number <= 0:
+ input_number = 0
+ elif input_number > max_downloads:
+ input_number = max_downloads
break
except:
- print(_("Invalid input! Try again with a valid input"))
+ print(_(f"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]"))
pacman_conf_path = pathlib.Path("/etc/pacman.conf")
with pacman_conf_path.open() as f:
@@ -223,7 +233,7 @@ def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Opt
with pacman_conf_path.open("w") as fwrite:
for line in pacman_conf:
if "ParallelDownloads" in line:
- fwrite.write(f"ParallelDownloads = {input_number}\n")
+ fwrite.write(f"ParallelDownloads = {input_number+1}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n")
else:
fwrite.write(f"{line}\n")