From 1e9e091a7eef140a71344d3384201fd580c76ed6 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Wed, 11 Apr 2018 23:20:56 +0200 Subject: Testing pre-steps --- archinstall.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/archinstall.py b/archinstall.py index df857a87..9c22e680 100644 --- a/archinstall.py +++ b/archinstall.py @@ -237,6 +237,29 @@ if __name__ == '__main__': o = run("sed -i 's/#Server/Server/' /root/mirrorlist") o = run('rankmirrors -n 6 /root/mirrorlist > /etc/pacman.d/mirrorlist') + pre_conf = {} + if 'pre' in instructions: + pre_conf = instructions['pre'] + elif 'prerequisits' in instructions: + pre_conf = instructions['prerequisits'] + + ## Prerequisit steps needs to NOT be executed in arch-chroot. + ## Mainly because there's no root structure to chroot into. + ## But partly because some configurations need to be done against the live CD. + ## (For instance, modifying mirrors are done on LiveCD and replicated intwards) + for title in pre_conf: + print('[N] Network prerequisit step: {}'.format(title)) + for command in pre_conf[title]: + opts = pre_conf[title][command] if type(pre_conf[title][command]) in (dict, oDict) else {} + if len(opts): + print('[-] Options: {}'.format(opts)) + + #print('[N] Command: {} ({})'.format(command, opts)) + o = run('{c}'.format(c=command), opts) + if type(conf[title][command]) == bytes and len(conf[title][command]) and not conf[title][command] in o: + print('[W] Prerequisit step failed: {}'.format(o.decode('UTF-8'))) + #print(o) + print('[N] Straping in packages.') o = run('pacman -Syy') o = run('pacstrap /mnt base base-devel btrfs-progs efibootmgr nano wpa_supplicant dialog {packages}'.format(**args)) -- cgit v1.2.3-70-g09d2