From ee7dff7f84053d82388704a992f82a2baac57fe8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 10 Apr 2019 08:37:52 +0200 Subject: Reworked according to the new data structure. Changing rooms still doesnt work. And some other things might not as well.. such as file uploads.. but meh, beta test time! Fix issue #10 --- archinstall.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index c7d6062b..e5b02b1a 100644 --- a/archinstall.py +++ b/archinstall.py @@ -113,6 +113,10 @@ def grab_partitions(dev): drive_name = os.path.basename(dev) parts = oDict() o = run('lsblk -o name -J -b {dev}'.format(dev=dev)) + if b'not a block device' in o: + ## TODO: Replace o = run() with code, o = run() + ## and make run() return the exit-code, way safer than checking output strings :P + return {} r = json.loads(o) if len(r['blockdevices']) and 'children' in r['blockdevices'][0]: for part in r['blockdevices'][0]['children']: @@ -465,7 +469,14 @@ if __name__ == '__main__': command = command.format(**args) #print('[N] Command: {} ({})'.format(command, opts)) - o = run('arch-chroot /mnt {c}'.format(c=command), opts) + + ## https://superuser.com/questions/1242978/start-systemd-nspawn-and-execute-commands-inside + ## !IMPORTANT + ## + ## arch-chroot mounts /run into the chroot environment, this breaks name resolves for some reason. + ## Either skipping mounting /run and using traditional chroot is an option, but using + ## `systemd-nspawn -D /mnt --machine temporary` might be a more flexible solution in case of file structure changes. + o = run('systemd-nspawn -D /mnt --machine temporary {c}'.format(c=command), opts) if type(conf[title][raw_command]) == bytes and len(conf[title][raw_command]) and not conf[title][raw_command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2