index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Lord Anton Hvornum <anton.feeds@gmail.com> | 2018-05-05 19:13:48 +0200 |
---|---|---|
committer | Lord Anton Hvornum <anton.feeds@gmail.com> | 2018-05-05 19:13:48 +0200 |
commit | ba09d311a21bdc5757237253d07a21019fceedcb (patch) | |
tree | edcdf115dd4eaa18c7a195f3ffa69f5314fc3567 /archinstall.py | |
parent | 97c44e0d945b806aad73fe8ffba9d5d3dc867d2a (diff) |
-rw-r--r-- | archinstall.py | 28 |
diff --git a/archinstall.py b/archinstall.py index dad42737..9fa0d07e 100644 --- a/archinstall.py +++ b/archinstall.py @@ -81,9 +81,10 @@ def update_git(): def device_state(name): # Based out of: https://askubuntu.com/questions/528690/how-to-get-list-of-all-non-removable-disk-device-names-ssd-hdd-and-sata-ide-onl/528709#528709 - with open('/sys/block/{}/device/block/{}/removable'.format(name, name)) as f: - if f.read(1) == '1': - return + if os.path.isfile('/sys/block/{}/device/block/{}/removable'.format(name, name)): + with open('/sys/block/{}/device/block/{}/removable'.format(name, name)) as f: + if f.read(1) == '1': + return path = rootdir_pattern.sub('', os.readlink('/sys/block/{}'.format(name))) hotplug_buses = ("usb", "ieee1394", "mmc", "pcmcia", "firewire") @@ -96,20 +97,15 @@ def device_state(name): return True def grab_partitions(dev): - o = run('parted -m -s {} p'.format(dev)).decode('UTF-8') + drive_name = os.path.basename(dev) parts = oDict() - for line in o.split('\n'): - if ':' in line: - data = line.split(':') - if data[0].isdigit(): - parts[int(data[0])] = { - 'start' : data[1], - 'end' : data[2], - 'size' : data[3], - 'sum' : data[4], - 'label' : data[5], - 'options' : data[6] - } + o = run('lsblk -o name -J -b {dev}'.format(dev=dev)) + r = json.loads(o) + for part in r['blockdevices'][0]['children']: + parts[part['name'][len(drive_name):]] = { + # TODO: Grab partition info and store here? + } + return parts def update_drive_list(): |