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:
Diffstat (limited to 'archinstall/lib/user_interaction')
-rw-r--r--archinstall/lib/user_interaction/__init__.py2
-rw-r--r--archinstall/lib/user_interaction/general_conf.py24
2 files changed, 25 insertions, 1 deletions
diff --git a/archinstall/lib/user_interaction/__init__.py b/archinstall/lib/user_interaction/__init__.py
index 8aba4b4d..a1ca2652 100644
--- a/archinstall/lib/user_interaction/__init__.py
+++ b/archinstall/lib/user_interaction/__init__.py
@@ -7,6 +7,6 @@ from .network_conf import ask_to_configure_network
from .partitioning_conf import select_partition, select_encrypted_partitions
from .general_conf import (ask_ntp, ask_for_a_timezone, ask_for_audio_selection, select_language, select_mirror_regions,
select_profile, select_archinstall_language, ask_additional_packages_to_install,
- select_additional_repositories, ask_hostname)
+ select_additional_repositories, ask_hostname, add_number_of_parrallel_downloads)
from .disk_conf import ask_for_main_filesystem_format, select_individual_blockdevice_usage, select_disk_layout, select_disk
from .utils import get_password, do_countdown
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index 754ffa29..44147afa 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
+import pathlib
from typing import List, Any, Optional, Dict, TYPE_CHECKING
from ..menu.menu import MenuSelectionType
@@ -205,6 +206,29 @@ 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:
+ try:
+ input_number = int(TextInput("> ").run().strip() or 0)
+ break
+ except:
+ print(_("Invalid input! Try again with a valid input"))
+
+ pacman_conf_path = pathlib.Path("/etc/pacman.conf")
+ with pacman_conf_path.open() as f:
+ pacman_conf = f.read().split("\n")
+
+ with pacman_conf_path.open("w") as fwrite:
+ for line in pacman_conf:
+ if "ParallelDownloads" in line:
+ fwrite.write(f"ParallelDownloads = {input_number}\n")
+ else:
+ fwrite.write(f"{line}\n")
+
+ return input_number
+
def select_additional_repositories(preset: List[str]) -> List[str]:
"""