From 7a018415862677c165494decc5d8ad9e06c65fb7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 16 Dec 2021 09:00:10 +0000 Subject: Changed lsblk to blkid where possible (#802) * Swapped lsblk for blkid * Added a hefty sleep on partprobe() And added a TODO for the future --- archinstall/lib/disk/filesystem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/disk/filesystem.py') diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index ac970b2a..72be7e70 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -36,6 +36,9 @@ class Filesystem: def partuuid_to_index(self, uuid): for i in range(storage['DISK_RETRY_ATTEMPTS']): self.partprobe() + time.sleep(5) + + # TODO: Convert to blkid (or something similar, but blkid doesn't support traversing to list sub-PARTUUIDs based on blockdevice path?) output = json.loads(SysCommand(f"lsblk --json -o+PARTUUID {self.blockdevice.device}").decode('UTF-8')) for device in output['blockdevices']: @@ -127,7 +130,6 @@ class Filesystem: def partprobe(self): SysCommand(f'bash -c "partprobe"') - time.sleep(1) def raw_parted(self, string: str): if (cmd_handle := SysCommand(f'/usr/bin/parted -s {string}')).exit_code != 0: @@ -205,5 +207,9 @@ class Filesystem: SysCommand(f'bash -c "umount {device}?"') except: pass + + self.partprobe() + worked = self.raw_parted(f'{device} mklabel {disk_label}').exit_code == 0 self.partprobe() - return self.raw_parted(f'{device} mklabel {disk_label}').exit_code == 0 + + return worked -- cgit v1.2.3-70-g09d2