Format ESP

This commit is contained in:
Filip Stedronsky 2021-10-16 18:23:05 +02:00
parent a0d6545ed8
commit 6167ef22c5

View File

@ -43,6 +43,8 @@ def with_device(pth):
subprocess.run(['partprobe', pth]) subprocess.run(['partprobe', pth])
time.sleep(1) time.sleep(1)
yield pth yield pth
else:
raise Exception(f"'{pth}' is neither a file nor a block device")
def ci_lookup(base, *comps, creating=False, parents=False): def ci_lookup(base, *comps, creating=False, parents=False):
"""Lookup path components case-insensitively""" """Lookup path components case-insensitively"""
@ -204,6 +206,9 @@ def main(*, disk=None, part=None, wim=None, iso=None, image_name=None, unattend=
#create_partitions(dev) #create_partitions(dev)
if not postproc_only and not efi: setup_mbr(dev) if not postproc_only and not efi: setup_mbr(dev)
part = part_path(dev, 1) part = part_path(dev, 1)
if efi and not postproc_only: # format ESP
esp = part_path(dev, 2)
cmd = ['mkfs.fat', '-F32', str(esp)]
setup_part(part, wim, image_name, unattend=unattend, postproc=postproc, postproc_only=postproc_only) setup_part(part, wim, image_name, unattend=unattend, postproc=postproc, postproc_only=postproc_only)
else: else:
setup_part(part, unattend=unattend, postproc=postproc, postproc_only=postproc_only) setup_part(part, unattend=unattend, postproc=postproc, postproc_only=postproc_only)