Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-02-07 15:09:40 +0100
committerAnton Hvornum <anton@hvornum.se>2021-02-07 15:09:40 +0100
commit759b7787439e49c03cc330cf0500977c0b83696e (patch)
tree8a63e2995ace66a078e3f72d5931077276275120 /archinstall
parent976709525816a8a47c30ae02abba9062499ad8b2 (diff)
Added some more failsafe's to the Partition() object.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/disk.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 7ffc866c..93d24613 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -120,20 +120,23 @@ class Partition():
part_id = os.path.basename(path)
self.path = path
self.part_id = part_id
- self.mountpoint = None
- self.filesystem = filesystem # TODO: Autodetect if we're reusing a partition
+ self.mountpoint = mountpoint
+ self.filesystem = filesystem
self.size = size # TODO: Refresh?
self.encrypted = encrypted
if mountpoint:
self.mount(mountpoint)
- if not self.mountpoint:
- # As a last step, check if we've mounted outside of the script
- partition_info = get_partition_info(self.path)
- self.mountpoint = partition_info['target']
- if partition_info['fstype'] != self.filesystem and filesystem:
- raise DiskError(f"{self} was given a filesystem format, but a existing format was detected: {partition_info['fstype']}")
+ partition_info = get_partition_info(self.path)
+
+ if self.mountpoint != partition_info['target'] and mountpoint:
+ raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {partition_info['target']}")
+ if partition_info['fstype'] != self.filesystem and filesystem:
+ raise DiskError(f"{self} was given a filesystem format, but a existing format was detected: {partition_info['fstype']}")
+
+ self.mountpoint = partition_info['target']
+ self.filesystem = partition_info['fstype']
def __repr__(self, *args, **kwargs):
if self.encrypted: