From 21dd295259e26580faa259dfe32d8e9554ae8933 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Fri, 8 Mar 2024 00:42:25 +1100 Subject: Fix 2337 (and similar) - Ignore existing partitions (#2342) * Fix 2337 * Update --- archinstall/lib/disk/device_handler.py | 8 ++++---- archinstall/lib/disk/device_model.py | 3 +++ archinstall/lib/disk/filesystem.py | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index 5b97f25d..59ee150d 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -296,15 +296,15 @@ class DeviceHandler(object): the formatting functionality and in essence the support for the given filesystem. """ - # don't touch existing partitions - filtered_part = [p for p in device_mod.partitions if not p.exists()] + # only verify partitions that are being created or modified + create_or_modify_parts = [p for p in device_mod.partitions if p.is_create_or_modify()] - self._validate_partitions(filtered_part) + self._validate_partitions(create_or_modify_parts) # make sure all devices are unmounted self._umount_all_existing(device_mod.device_path) - for part_mod in filtered_part: + for part_mod in create_or_modify_parts: # partition will be encrypted if enc_conf is not None and part_mod in enc_conf.partitions: self._perform_enc_formatting( diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py index 54b4932b..d4563faa 100644 --- a/archinstall/lib/disk/device_model.py +++ b/archinstall/lib/disk/device_model.py @@ -793,6 +793,9 @@ class PartitionModification: def is_exists_or_modify(self) -> bool: return self.status in [ModificationStatus.Exist, ModificationStatus.Modify] + def is_create_or_modify(self) -> bool: + return self.status in [ModificationStatus.Create, ModificationStatus.Modify] + @property def mapper_name(self) -> Optional[str]: if self.dev_path: diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index dc99afce..9c6e6d35 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -55,8 +55,9 @@ class FilesystemHandler: device_handler.format(mod, enc_conf=self._enc_config) for part_mod in mod.partitions: - if part_mod.fs_type == FilesystemType.Btrfs: - device_handler.create_btrfs_volumes(part_mod, enc_conf=self._enc_config) + if part_mod.is_create_or_modify(): + if part_mod.fs_type == FilesystemType.Btrfs: + device_handler.create_btrfs_volumes(part_mod, enc_conf=self._enc_config) def _do_countdown(self) -> bool: SIG_TRIGGER = False -- cgit v1.2.3-70-g09d2