Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-06-11 17:22:20 +0200
committerAnton Hvornum <anton@hvornum.se>2021-06-11 17:22:20 +0200
commit24476ac1f696c882fb2f741cb8c5fa858f786f46 (patch)
treed380ff03b75fe09f27b750c19937cf0843c4a8c2 /archinstall/lib/disk.py
parent0a8c061ab405e244a187b4615654ecca2e538156 (diff)
Made it so that the .partitions property of Install() fetches from live data, rather than storing and caching partitions on initation. Since it now supports mounting a partition layout given by external usage.
Diffstat (limited to 'archinstall/lib/disk.py')
-rw-r--r--archinstall/lib/disk.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 8e9d0d3f..7a7fce5e 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -636,7 +636,7 @@ class Filesystem:
:param string: A raw string passed to /usr/bin/parted -s <string>
:type string: str
"""
- return self.raw_parted(string).exit_code
+ return self.raw_parted(string).exit_code == 0
def use_entire_disk(self, root_filesystem_type='ext4') -> Partition:
# TODO: Implement this with declarative profiles instead.
@@ -652,20 +652,22 @@ class Filesystem:
DiskError("Too many partitions on disk, MBR disks can only have 3 parimary partitions")
if partition_format:
- partitioning = self.parted(f'{self.blockdevice.device} mkpart {partition_type} {partition_format} {start} {end}') == 0
+ parted_string = f'{self.blockdevice.device} mkpart {partition_type} {partition_format} {start} {end}'
else:
- partitioning = self.parted(f'{self.blockdevice.device} mkpart {partition_type} {start} {end}') == 0
+ parted_string = f'{self.blockdevice.device} mkpart {partition_type} {start} {end}'
- if partitioning:
+ if self.parted(parted_string):
start_wait = time.time()
while previous_partition_uuids == {partition.uuid for partition in self.blockdevice.partitions.values()}:
if time.time() - start_wait > 10:
raise DiskError(f"New partition never showed up after adding new partition on {self} (timeout 10 seconds).")
time.sleep(0.025)
+
time.sleep(0.5) # Let the kernel catch up with quick block devices (nvme for instance)
return self.blockdevice.get_partition(uuid=(previous_partition_uuids ^ {partition.uuid for partition in self.blockdevice.partitions.values()}).pop())
+
def set_name(self, partition: int, name: str):
return self.parted(f'{self.blockdevice.device} name {partition + 1} "{name}"') == 0
@@ -673,6 +675,7 @@ class Filesystem:
return self.parted(f'{self.blockdevice.device} set {partition + 1} {string}') == 0
def parted_mklabel(self, device: str, disk_label: str):
+ log(f"Creating a new partition labling on {device}", level=logging.INFO, fg="yellow")
# Try to unmount devices before attempting to run mklabel
try:
SysCommand(f'bash -c "umount {device}?"')