From 4d3595ecfc2f58176f81fa1f78ab214fb61aaafe Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Thu, 20 May 2021 18:11:22 +0530 Subject: changed "desktop" to "profile" while loading config --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index b3e87df7..f53078db 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -408,6 +408,6 @@ else: # Temporarily disabling keep_partitions if config file is loaded archinstall.arguments['harddrive'].keep_partitions = False # Temporary workaround to make Desktop Environments work - archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('desktop', None)) + archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 33f1957e4d10d212c87f0500107d426ff871131a Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Fri, 21 May 2021 01:58:32 +0530 Subject: fallback added for when profile is null/empty --- examples/guided.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index f53078db..c18e5039 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -408,6 +408,9 @@ else: # Temporarily disabling keep_partitions if config file is loaded archinstall.arguments['harddrive'].keep_partitions = False # Temporary workaround to make Desktop Environments work - archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) + if archinstall.arguments.get('profile', None) is not None: + archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) + else: + archinstall.arguments['profile'] = None perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 23d223b15cacd5139150162a4328022ef12f6469 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Fri, 21 May 2021 04:00:09 +0530 Subject: fixed creating profile object if profile is passed in vars --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index c18e5039..3a2bc1c0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -179,6 +179,8 @@ def ask_user_questions(): # Ask for archinstall-specific profiles (such as desktop environments etc) if not archinstall.arguments.get('profile', None): archinstall.arguments['profile'] = archinstall.select_profile(archinstall.list_profiles(filter_top_level_profiles=True)) + else: + archinstall.arguments['profile'] = Profile(installer=None, path=archinstall.arguments['profile']) # Check the potentially selected profiles preparations to get early checks if some additional questions are needed. if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function(): -- cgit v1.2.3-70-g09d2 From 48f1e624279e5a0cb1914663d3d3e88982cbf751 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:03:16 +0530 Subject: bringing back the old method for parsing extra args as config values --- archinstall/__init__.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index ee4748f6..e5fbd95f 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -32,16 +32,7 @@ def initialize_arguments(): parser.add_argument("--silent", action="store_true", help="Warning!!! No prompts, ignored if config is not passed") parser.add_argument("--script", default="guided", nargs="?", help="Script to run for installation", type=str) - parser.add_argument("--vars", - metavar="KEY=VALUE", - nargs='?', - help="Set a number of key-value pairs " - "(do not put spaces before or after the = sign). " - "If a value contains spaces, you should define " - "it with double quotes: " - 'foo="this is a sentence". Note that ' - "values are always treated as strings.") - args = parser.parse_args() + args, unknowns = parser.parse_known_args() if args.config is not None: try: # First, let's check if this is a URL scheme instead of a filename @@ -57,14 +48,15 @@ def initialize_arguments(): print(e) # Installation can't be silent if config is not passed config["silent"] = args.silent - if args.vars is not None: - try: - for var in args.vars.split(' '): - key, val = var.split("=") - config[key] = val - except Exception as e: - print(e) + for arg in unknowns: + if '--' == arg[:2]: + if '=' in arg: + key, val = [x.strip() for x in arg[2:].split('=', 1)] + else: + key, val = arg[2:], True + config[key] = val config["script"] = args.script + print(config) return config -- cgit v1.2.3-70-g09d2 From 9be8a3a998ed671749665dae3fc432305ababc64 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:52:21 +0530 Subject: updated mirror-region config key to use value directly --- examples/guided.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index cbf30eb3..c6f40ac7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -445,5 +445,7 @@ else: archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)) else: archinstall.arguments['profile'] = None + if archinstall.arguments.get('mirror-region', None) is not None: + archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[archinstall.arguments.get('mirror-region', None)]} perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 194d45ad2dd9ae0bc051204810cfc5c38a22d33d Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:52:52 +0530 Subject: removed debug code --- archinstall/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index e5fbd95f..efd3e964 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -56,7 +56,6 @@ def initialize_arguments(): key, val = arg[2:], True config[key] = val config["script"] = args.script - print(config) return config -- cgit v1.2.3-70-g09d2 From 87955e0ba659c46a42d7a48955054b47874b38e2 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 11:56:19 +0530 Subject: fixed pulling mirror-region from config --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index c6f40ac7..31d11396 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -446,6 +446,7 @@ else: else: archinstall.arguments['profile'] = None if archinstall.arguments.get('mirror-region', None) is not None: - archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[archinstall.arguments.get('mirror-region', None)]} + selected_region = archinstall.arguments.get('mirror-region', None) + archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]} perform_installation_steps() -- cgit v1.2.3-70-g09d2 From 1d04acb603e46f7dcd52b5ecd6686265bbdc3059 Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 23 May 2021 13:33:48 +0530 Subject: added pulling sys-language and sys-encoding from config --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 31d11396..c3e5848b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -448,5 +448,7 @@ else: if archinstall.arguments.get('mirror-region', None) is not None: selected_region = archinstall.arguments.get('mirror-region', None) archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]} - + archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US') + archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8') + perform_installation_steps() -- cgit v1.2.3-70-g09d2