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-03-29 17:32:48 +0200
committerAnton Hvornum <anton@hvornum.se>2021-03-29 17:32:48 +0200
commita0980afff1d2458d348e144cb0d8351f862564c1 (patch)
tree2874e1011c2c345c948ab3b5da2fe2b5928548b0 /archinstall
parentf3907310e3fbbc07ad31f3558279cd73ba774472 (diff)
Experimenting with carrying over flags across cache flush. This to solve issues when flush is cleared and target mountpoints gets lost, making it impossible to do .find_mountpoint('/') later on for instance.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/disk.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index d6d28935..84a4ff37 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -130,7 +130,20 @@ class BlockDevice():
return False
def flush_cache(self):
+ old_partitions = {**self.partitions}
+
self.part_cache = OrderedDict()
+ # Trigger a refresh of the cache
+ if len(self.partitions):
+ pass
+
+ # Carry over any flags from the previous partitions
+ for partition in old_partitions:
+ if partition in self.part_cache:
+ if self.part_cache[partition].size == old_partitions[partition].size and \
+ self.part_cache[partition].filesystem == old_partitions[partition].filesystem:
+ print('Carrying over', self.part_cache[partition].target_mountpoint)
+ self.part_cache[partition].target_mountpoint = old_partitions[partition].target_mountpoint
class Partition():
def __init__(self, path :str, block_device :BlockDevice, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False, autodetect_filesystem=True):
@@ -237,7 +250,9 @@ class Partition():
return True if files > 0 else False
def safe_to_format(self):
- if self.block_device and self.block_device.keep_partitions is True:
+ if self.block_device and self.block_device.keep_partitions is False:
+ # If we don't intend to keep any partitions on the parent block device
+ # We're good to format.
return True
if self.allow_formatting is False:
@@ -325,6 +340,7 @@ class Partition():
else:
raise UnknownFilesystemFormat(f"Fileformat '{filesystem}' is not yet implemented.")
+ # self.encrypted = False if self.filesystem != 'crypto_LUKS' else True
if self.block_device:
self.block_device.flush_cache()