Option for Parallel Downloads (#1397)
* 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 Co-authored-by: Anton Hvornum <anton@hvornum.se>
This commit is contained in:
parent
5626c10927
commit
463114356c
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue