Fix `_add_efistub_bootloader()` partition number with partn (#2084)
This commit is contained in:
parent
c75ae97f00
commit
6d908e8cd7
|
|
@ -293,6 +293,7 @@ class DeviceHandler(object):
|
||||||
|
|
||||||
lsblk_info = self._fetch_part_info(part_mod.safe_dev_path)
|
lsblk_info = self._fetch_part_info(part_mod.safe_dev_path)
|
||||||
|
|
||||||
|
part_mod.partn = lsblk_info.partn
|
||||||
part_mod.partuuid = lsblk_info.partuuid
|
part_mod.partuuid = lsblk_info.partuuid
|
||||||
part_mod.uuid = lsblk_info.uuid
|
part_mod.uuid = lsblk_info.uuid
|
||||||
|
|
||||||
|
|
@ -371,7 +372,7 @@ class DeviceHandler(object):
|
||||||
time.sleep(attempt_nr + 1)
|
time.sleep(attempt_nr + 1)
|
||||||
lsblk_info = get_lsblk_info(path)
|
lsblk_info = get_lsblk_info(path)
|
||||||
|
|
||||||
if lsblk_info.partuuid and lsblk_info.uuid:
|
if lsblk_info.partn and lsblk_info.partuuid and lsblk_info.uuid:
|
||||||
break
|
break
|
||||||
|
|
||||||
self.partprobe(path)
|
self.partprobe(path)
|
||||||
|
|
@ -380,6 +381,10 @@ class DeviceHandler(object):
|
||||||
debug(f'Unable to get partition information: {path}')
|
debug(f'Unable to get partition information: {path}')
|
||||||
raise DiskError(f'Unable to get partition information: {path}')
|
raise DiskError(f'Unable to get partition information: {path}')
|
||||||
|
|
||||||
|
if not lsblk_info.partn:
|
||||||
|
debug(f'Unable to determine new partition number: {path}\n{lsblk_info}')
|
||||||
|
raise DiskError(f'Unable to determine new partition number: {path}')
|
||||||
|
|
||||||
if not lsblk_info.partuuid:
|
if not lsblk_info.partuuid:
|
||||||
debug(f'Unable to determine new partition uuid: {path}\n{lsblk_info}')
|
debug(f'Unable to determine new partition uuid: {path}\n{lsblk_info}')
|
||||||
raise DiskError(f'Unable to determine new partition uuid: {path}')
|
raise DiskError(f'Unable to determine new partition uuid: {path}')
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,7 @@ class PartitionModification:
|
||||||
|
|
||||||
# only set if the device was created or exists
|
# only set if the device was created or exists
|
||||||
dev_path: Optional[Path] = None
|
dev_path: Optional[Path] = None
|
||||||
|
partn: Optional[int] = None
|
||||||
partuuid: Optional[str] = None
|
partuuid: Optional[str] = None
|
||||||
uuid: Optional[str] = None
|
uuid: Optional[str] = None
|
||||||
|
|
||||||
|
|
@ -933,6 +934,7 @@ class LsblkInfo:
|
||||||
ptuuid: str = ''
|
ptuuid: str = ''
|
||||||
rota: bool = False
|
rota: bool = False
|
||||||
tran: Optional[str] = None
|
tran: Optional[str] = None
|
||||||
|
partn: Optional[int] = None
|
||||||
partuuid: Optional[str] = None
|
partuuid: Optional[str] = None
|
||||||
parttype :Optional[str] = None
|
parttype :Optional[str] = None
|
||||||
uuid: Optional[str] = None
|
uuid: Optional[str] = None
|
||||||
|
|
@ -957,6 +959,7 @@ class LsblkInfo:
|
||||||
'ptuuid': self.ptuuid,
|
'ptuuid': self.ptuuid,
|
||||||
'rota': self.rota,
|
'rota': self.rota,
|
||||||
'tran': self.tran,
|
'tran': self.tran,
|
||||||
|
'partn': self.partn,
|
||||||
'partuuid': self.partuuid,
|
'partuuid': self.partuuid,
|
||||||
'parttype' : self.parttype,
|
'parttype' : self.parttype,
|
||||||
'uuid': self.uuid,
|
'uuid': self.uuid,
|
||||||
|
|
|
||||||
|
|
@ -1085,7 +1085,7 @@ TIMEOUT=5
|
||||||
|
|
||||||
cmd = f'efibootmgr ' \
|
cmd = f'efibootmgr ' \
|
||||||
f'--disk {parent_dev_path} ' \
|
f'--disk {parent_dev_path} ' \
|
||||||
f'--part {boot_partition.safe_dev_path} ' \
|
f'--part {boot_partition.partn} ' \
|
||||||
f'--create ' \
|
f'--create ' \
|
||||||
f'--label "{label}" ' \
|
f'--label "{label}" ' \
|
||||||
f'--loader {loader} ' \
|
f'--loader {loader} ' \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue