From 85fd06fa8a20a1861c9ec0d8e15da954fe5cdd43 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 30 Sep 2020 09:11:36 +0000 Subject: Finalized magic function _prep_function(). Gets returned when a profile is imported through archinstall.select_profile() user-interaction helper function. Asks for additional user-input right away rather than half way into the installation. This makes sure user input is taken care of before starting the installation. Although it complicates the code layout a tiny bit. Profiles need a __name__ and a _prep_function combo in order to be safely executed by select_profile(). select_profile() will not attempt to run or execute the code in any way unless those to conditions are met. In theory :) --- examples/guided.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 7b09b159..0447df26 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -92,11 +92,19 @@ while 1: users[new_user] = new_user_passwd break -profile = archinstall.select_profile(archinstall.list_profiles()) +while 1: + profile = archinstall.select_profile(archinstall.list_profiles()) + if profile != str: # Got a imported profile + if not profile[1]._prep_function(): + archinstall.log(' * Profile\'s preperation requirements was not fulfilled.', bg='black', fg='red') + continue + profile = profile[0]._path # Once the prep is done, replace the selected profile with the profile name ("path") given from select_profile() + break + else: + break packages = input('Additional packages aside from base (space separated): ').split(' ') - """ Issue a final warning before we continue with something un-revertable. """ -- cgit v1.2.3-70-g09d2