From 85f2938df9e7e34a08fd1b1acc7c8b41d14ccb54 Mon Sep 17 00:00:00 2001 From: Werner Llácer Date: Fri, 4 Feb 2022 23:48:41 +0100 Subject: Moving load_config from guided to \__init__.py (#887) * The initializations done at the start of guided.py are now at archinstall/__init__.py The scripts have been changed accordingly * Correct definition of btrfs standard layout Co-authored-by: Anton Hvornum --- archinstall/__init__.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'archinstall/__init__.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index ea0962b2..f0ce026c 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -165,6 +165,38 @@ def get_arguments(): del config['dry-run'] return config +def load_config(): + """ + refine and set some arguments. Formerly at the scripts + """ + if arguments.get('harddrives', None) is not None: + if type(arguments['harddrives']) is str: + arguments['harddrives'] = arguments['harddrives'].split(',') + arguments['harddrives'] = [BlockDevice(BlockDev) for BlockDev in arguments['harddrives']] + # Temporarily disabling keep_partitions if config file is loaded + # Temporary workaround to make Desktop Environments work + if arguments.get('profile', None) is not None: + if type(arguments.get('profile', None)) is dict: + arguments['profile'] = Profile(None, arguments.get('profile', None)['path']) + else: + arguments['profile'] = Profile(None, arguments.get('profile', None)) + storage['_desktop_profile'] = arguments.get('desktop-environment', None) + if arguments.get('mirror-region', None) is not None: + if type(arguments.get('mirror-region', None)) is dict: + arguments['mirror-region'] = arguments.get('mirror-region', None) + else: + selected_region = arguments.get('mirror-region', None) + arguments['mirror-region'] = {selected_region: list_mirrors()[selected_region]} + if arguments.get('sys-language', None) is not None: + arguments['sys-language'] = arguments.get('sys-language', 'en_US') + if arguments.get('sys-encoding', None) is not None: + arguments['sys-encoding'] = arguments.get('sys-encoding', 'utf-8') + if arguments.get('gfx_driver', None) is not None: + storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(arguments.get('gfx_driver', None), None) + if arguments.get('servers', None) is not None: + storage['_selected_servers'] = arguments.get('servers', None) + + def post_process_arguments(arguments): storage['arguments'] = arguments if arguments.get('mount_point'): @@ -191,6 +223,8 @@ def post_process_arguments(arguments): del partition['format'] arguments['disk_layouts'] = layout_storage + load_config() + define_arguments() arguments = get_arguments() -- cgit v1.2.3-70-g09d2