index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Abhay Mohandas <80393938+abhay-mohandas@users.noreply.github.com> | 2022-08-01 19:09:39 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-01 15:39:39 +0200 |
commit | 463114356cd195b5402fc7f280508fea6566a7df (patch) | |
tree | 9200e417be072a7dbaf21fa001078c34feecd3d7 /archinstall/lib | |
parent | 5626c109272b7d34d25facbd2b22f466bf1f4ce2 (diff) |
-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 |
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]: """ |