Removing a flush of the cache that was excessive.

This commit is contained in:
Anton Hvornum 2021-03-29 17:46:07 +02:00
parent 512f0327f0
commit a29bd75954
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 6 additions and 27 deletions

View File

@ -130,21 +130,7 @@ 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].allow_formatting)
self.part_cache[partition].target_mountpoint = old_partitions[partition].target_mountpoint
self.part_cache[partition].allow_formatting = old_partitions[partition].allow_formatting
class Partition():
def __init__(self, path :str, block_device :BlockDevice, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False, autodetect_filesystem=True):
@ -341,9 +327,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()
self.encrypted = False if self.filesystem != 'crypto_LUKS' else True
return True
@ -460,7 +444,7 @@ class Filesystem():
"""
return self.raw_parted(string).exit_code
def use_entire_disk(self, root_filesystem_type='ext4', encrypt_root_partition=True):
def use_entire_disk(self, root_filesystem_type='ext4'):
log(f"Using and formatting the entire {self.blockdevice}.", level=LOG_LEVELS.Debug)
self.add_partition('primary', start='1MiB', end='513MiB', format='fat32')
self.set_name(0, 'EFI')
@ -480,11 +464,6 @@ class Filesystem():
self.blockdevice.partition[0].allow_formatting = True
self.blockdevice.partition[1].allow_formatting = True
if encrypt_root_partition:
log(f"Marking partition {self.blockdevice.partition[1]} as encrypted.", level=LOG_LEVELS.Debug)
self.blockdevice.partition[1].encrypted = True
def add_partition(self, type, start, end, format=None):
log(f'Adding partition to {self.blockdevice}', level=LOG_LEVELS.Info)

View File

@ -247,10 +247,10 @@ def perform_installation_steps():
with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
# Wipe the entire drive if the disk flag `keep_partitions`is False.
if archinstall.arguments['harddrive'].keep_partitions is False:
fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'),
encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
# Otherwise, check if encryption is desired and mark the root partition as encrypted.
elif archinstall.arguments.get('!encryption-password', None):
fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'))
# Check if encryption is desired and mark the root partition as encrypted.
if archinstall.arguments.get('!encryption-password', None):
root_partition = fs.find_partition('/')
root_partition.encrypted = True