Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/__init__.py34
-rw-r--r--examples/guided.py29
-rw-r--r--examples/only_hd.py53
3 files changed, 34 insertions, 82 deletions
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()
diff --git a/examples/guided.py b/examples/guided.py
index 9071ce39..e14e58cf 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -22,34 +22,6 @@ archinstall.log(f"Graphics devices detected: {archinstall.graphics_devices().key
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG)
-def load_config():
- if archinstall.arguments.get('harddrives', None) is not None:
- if type(archinstall.arguments['harddrives']) is str:
- archinstall.arguments['harddrives'] = archinstall.arguments['harddrives'].split(',')
- archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives']]
- # Temporarily disabling keep_partitions if config file is loaded
- # Temporary workaround to make Desktop Environments work
- if archinstall.arguments.get('profile', None) is not None:
- if type(archinstall.arguments.get('profile', None)) is dict:
- archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)['path'])
- else:
- archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None))
- archinstall.storage['_desktop_profile'] = archinstall.arguments.get('desktop-environment', None)
- if archinstall.arguments.get('mirror-region', None) is not None:
- if type(archinstall.arguments.get('mirror-region', None)) is dict:
- archinstall.arguments['mirror-region'] = archinstall.arguments.get('mirror-region', None)
- else:
- selected_region = archinstall.arguments.get('mirror-region', None)
- archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
- if archinstall.arguments.get('sys-language', None) is not None:
- archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US')
- if archinstall.arguments.get('sys-encoding', None) is not None:
- archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
- if archinstall.arguments.get('gfx_driver', None) is not None:
- archinstall.storage['gfx_driver_packages'] = archinstall.AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
- if archinstall.arguments.get('servers', None) is not None:
- archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
-
def ask_user_questions():
"""
@@ -325,7 +297,6 @@ if not archinstall.arguments.get('offline', False):
archinstall.log(f"Failed to update the keyring. Please check your internet connection and the log file '{log_file}'.", level=logging.INFO, fg="red")
exit(1)
-load_config()
if not archinstall.arguments.get('silent'):
ask_user_questions()
diff --git a/examples/only_hd.py b/examples/only_hd.py
index 755e00f5..f1bddbb2 100644
--- a/examples/only_hd.py
+++ b/examples/only_hd.py
@@ -5,28 +5,6 @@ import pathlib
import archinstall
-def load_mirror():
- if archinstall.arguments.get('mirror-region', None) is not None:
- if type(archinstall.arguments.get('mirror-region', None)) is dict:
- archinstall.arguments['mirror-region'] = archinstall.arguments.get('mirror-region', None)
- else:
- selected_region = archinstall.arguments.get('mirror-region', None)
- archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
-
-def load_localization():
- if archinstall.arguments.get('sys-language', None) is not None:
- archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US')
- if archinstall.arguments.get('sys-encoding', None) is not None:
- archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
-
-def load_harddrives():
- if archinstall.arguments.get('harddrives', None) is not None:
- if type(archinstall.arguments['harddrives']) is str:
- archinstall.arguments['harddrives'] = archinstall.arguments['harddrives'].split(',')
- archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives']]
- # Temporarily disabling keep_partitions if config file is loaded
-
-
def ask_harddrives():
# Ask which harddrives/block-devices we will install to
# and convert them into archinstall.BlockDevice() objects.
@@ -63,35 +41,6 @@ def ask_harddrives():
if not archinstall.arguments.get('swap', None):
archinstall.arguments['swap'] = archinstall.ask_for_swap()
-def load_profiles():
- if archinstall.arguments.get('profile', None) is not None:
- if type(archinstall.arguments.get('profile', None)) is dict:
- archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)['path'])
- else:
- archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None))
-
-def load_desktop_profiles():
- # Temporary workaround to make Desktop Environments work
- archinstall.storage['_desktop_profile'] = archinstall.arguments.get('desktop-environment', None)
-
-def load_gfxdriver():
- if archinstall.arguments.get('gfx_driver', None) is not None:
- archinstall.storage['gfx_driver_packages'] = archinstall.AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
-
-def load_servers():
- if archinstall.arguments.get('servers', None) is not None:
- archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
-
-
-def load_config():
- load_harddrives()
- load_profiles()
- load_desktop_profiles()
- load_mirror()
- load_localization()
- load_gfxdriver()
- load_servers()
-
def ask_user_questions():
"""
First, we'll ask the user for a bunch of user input.
@@ -219,8 +168,6 @@ if not archinstall.check_mirror_reachable():
archinstall.log(f"Arch Linux mirrors are not reachable. Please check your internet connection and the log file '{log_file}'.", level=logging.INFO, fg="red")
exit(1)
-load_config()
-
if not archinstall.arguments.get('silent'):
ask_user_questions()