From 16ff533c81b0d9c92cd4fc2089e96ff4fa3f19a7 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sun, 8 Apr 2018 13:45:30 +0200 Subject: Improved sys exec to enable debug output via net deploy --- archinstall.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/archinstall.py b/archinstall.py index a48191ad..a16ff8fb 100644 --- a/archinstall.py +++ b/archinstall.py @@ -43,19 +43,20 @@ def get_local_MACs(): macs[addr.address] = nic return macs -def run(cmd, echo=False, *args, **kwargs): +def run(cmd, echo=False, opts=None, *args, **kwargs): + if not opts: opts = {} #print('[!] {}'.format(cmd)) handle = Popen(cmd, shell='True', stdout=PIPE, stderr=STDOUT, **kwargs) output = b'' while handle.poll() is None: data = handle.stdout.read() if len(data): - if echo and 'flush': + if echo or 'debug' in opts: print(data.decode('UTF-8'), end='') # print(data.decode('UTF-8'), end='') output += data data = handle.stdout.read() - if echo: + if echo or 'debug' in opts: print(data.decode('UTF-8'), end='') output += data handle.stdout.close() @@ -297,7 +298,7 @@ if __name__ == '__main__': opts = conf[title][command] if type(conf[title][command]) in (dict, oDict) else {} #print('[N] Command: {} ({})'.format(command, opts)) - o = run('arch-chroot /mnt {c}'.format(c=command), **opts) + o = run('arch-chroot /mnt {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] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2