Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-03-16 17:20:26 +0100
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-03-16 17:20:26 +0100
commitcab78fee0a2428ae15586a46e877d945ad3f0976 (patch)
tree169e6dae5dc6ec8c09a593a1227948c99ad2b0be /archinstall.py
parent113c7c23b03b3f05f3d1c1cf5ac643a0122a3855 (diff)
New feature: input_redirect in cleanup_args(). Since this function might be run from outside a tty, there's no way to get input. So an external input handler is required. This enables that functionality. Also some cleanup to get_instructions so that we can load them from some where else in the future.
Diffstat (limited to 'archinstall.py')
-rw-r--r--archinstall.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/archinstall.py b/archinstall.py
index 6fec833f..ae945e5d 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -558,10 +558,12 @@ def disk_info(drive, *positionals, **kwargs):
return info
-def cleanup_args():
+def cleanup_args(*positionals, **kwargs):
for key in args:
if args[key] == '<STDIN>':
if not args['unattended']:
+ if 'input_redirect' in kwargs:
+ args[key] = kwargs['input_redirect'](key)
args[key] = input(f'Enter a value for {key}: ')
else:
args[key] = random_string(32)
@@ -725,12 +727,13 @@ def get_local_instructions(target):
return instructions
def get_instructions(target, *positionals, **kwargs):
+ if not 'profiles-path' in kwargs: kwargs['profiles-path'] = args['profiles-path']
instructions = oDict()
if target[0-len('.json'):] == '.json': target = target[:0-len('.json')]
log(f'Fetching instructions for {target}', level=4, origin='get_instructions')
if get_default_gateway_linux():
try:
- instructions = grab_url_data('{}/{}.json'.format(args['profiles-path'], target)).decode('UTF-8')
+ instructions = grab_url_data(f"{kwargs['profiles-path']}/{target}.json").decode('UTF-8')
log(f'Found net-deploy instructions for {target}', level=4, origin='get_instructions')
print('[N] Found net-deploy instructions called: {}'.format(target))
except urllib.error.HTTPError:
@@ -745,7 +748,7 @@ def get_instructions(target, *positionals, **kwargs):
instructions = json.loads(instructions, object_pairs_hook=oDict)
except:
log(f'JSON syntax error in: {target}', level=4, origin='get_instructions')
- print('[E] JSON syntax error in {}'.format('{}/{}.json'.format(args['profiles-path'], target)))
+ print('[E] JSON syntax error in {}'.format('{}/{}.json'.format(kwargs['profiles-path'], target)))
traceback.print_exc()
exit(1)