image-info: support for peculiar partitions
Add support for partitions that can 'blkid' can not handle, like the bios boot partition. For such partitions, 'blkid' will fail; in that case all additional information will just be 'None'.
This commit is contained in:
parent
598c2b6939
commit
5bca8bcacd
1 changed files with 7 additions and 2 deletions
|
|
@ -143,8 +143,13 @@ def read_image_format(device):
|
|||
|
||||
|
||||
def read_partition(device, partition):
|
||||
blkid = subprocess_check_output(["blkid", "--output", "export", device],
|
||||
parse_environment_vars)
|
||||
res = subprocess.run(["blkid", "--output", "export", device],
|
||||
check=False, encoding="utf-8",
|
||||
stdout=subprocess.PIPE)
|
||||
if res.returncode == 0:
|
||||
blkid = parse_environment_vars(res.stdout)
|
||||
else:
|
||||
blkid = {}
|
||||
|
||||
partition["label"] = blkid.get("LABEL") # doesn't exist for mbr
|
||||
partition["uuid"] = blkid.get("UUID")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue