This should fix #151, by using lsblk instead of /dev/disk/by-partuuid. It also cleaned up the installer code quite a bit during the bootloader installation. Will do the same for encrypted drives later on by implementing UUID on a BlockDevice (disk) level.
This commit is contained in:
parent
2bf947ba05
commit
b2927a5067
|
|
@ -190,6 +190,17 @@ class Partition():
|
|||
else:
|
||||
return f'Partition(path={self.path}, fs={self.filesystem}{mount_repr})'
|
||||
|
||||
@property
|
||||
def uuid(self) -> str:
|
||||
"""
|
||||
Returns the PARTUUID as returned by lsblk.
|
||||
This is more reliable than relying on /dev/disk/by-partuuid as
|
||||
it doesn't seam to be able to detect md raid partitions.
|
||||
"""
|
||||
lsblk = b''.join(sys_command(f'lsblk -J {self.path}'))
|
||||
for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
|
||||
return partition['partuuid']
|
||||
|
||||
@property
|
||||
def encrypted(self):
|
||||
return self._encrypted
|
||||
|
|
|
|||
|
|
@ -384,18 +384,10 @@ class Installer():
|
|||
break
|
||||
else:
|
||||
log(f"Identifying root partition by PART-UUID on {self.partition}, looking for '{os.path.basename(self.partition.path)}'.", level=LOG_LEVELS.Debug)
|
||||
for root, folders, uids in os.walk('/dev/disk/by-partuuid'):
|
||||
for uid in uids:
|
||||
real_path = os.path.realpath(os.path.join(root, uid))
|
||||
entry.write(f'options root=PARTUUID={self.partition.uuid} rw intel_pstate=no_hwp\n')
|
||||
|
||||
log(f"Checking root partition match {os.path.basename(real_path)} against {os.path.basename(self.partition.path)}: {os.path.basename(real_path) == os.path.basename(self.partition.path)}", level=LOG_LEVELS.Debug)
|
||||
if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue
|
||||
|
||||
entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n')
|
||||
|
||||
self.helper_flags['bootloader'] = bootloader
|
||||
return True
|
||||
break
|
||||
self.helper_flags['bootloader'] = bootloader
|
||||
return True
|
||||
|
||||
raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue