index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/menu/global_menu.py | 10 | ||||
-rw-r--r-- | archinstall/lib/user_interaction/__init__.py | 2 | ||||
-rw-r--r-- | archinstall/lib/user_interaction/general_conf.py | 24 | ||||
-rw-r--r-- | examples/guided.py | 4 |
diff --git a/archinstall/lib/menu/global_menu.py b/archinstall/lib/menu/global_menu.py index d9943945..b518ac22 100644 --- a/archinstall/lib/menu/global_menu.py +++ b/archinstall/lib/menu/global_menu.py @@ -32,6 +32,7 @@ from ..user_interaction import select_encrypted_partitions from ..user_interaction import select_harddrives from ..user_interaction import select_profile from ..user_interaction import select_additional_repositories +from ..user_interaction import add_number_of_parrallel_downloads from ..models.users import User from ..user_interaction.partitioning_conf import current_partition_layout from ..output import FormattedOutput @@ -145,6 +146,15 @@ class GlobalMenu(GeneralMenu): display_func=lambda x: x if x else 'None', default=None ) + + self._menu_options['parallel downloads'] = \ + Selector( + _('Parallel Downloads'), + add_number_of_parrallel_downloads, + display_func=lambda x: x if x else '0', + default=None + ) + self._menu_options['kernels'] = \ Selector( _('Kernels'), 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]: """ diff --git a/examples/guided.py b/examples/guided.py index 0bb377a4..bbf19bf9 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -85,6 +85,10 @@ def ask_user_questions(): global_menu.enable('packages') + if archinstall.arguments.get('advanced', False): + # Enable parallel downloads + global_menu.enable('parallel downloads') + # Ask or Call the helper function that asks the user to optionally configure a network. global_menu.enable('nic') |