From f05af2e6c4685e2b20f0cc85ec32453cf16eee45 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Thu, 23 Jan 2025 01:50:35 -0500 Subject: [PATCH] Consolidate preparations for lvm and partitions (#3135) --- archinstall/lib/installer.py | 53 ++++++++++++++---------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 33a59f54..f2f27e82 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -772,36 +772,6 @@ class Installer: if 'encrypt' not in self._hooks: self._hooks.insert(self._hooks.index(before), 'encrypt') - def _handle_partition_installation(self) -> None: - pvs = [] - if self._disk_config.lvm_config: - pvs = self._disk_config.lvm_config.get_all_pvs() - - for mod in self._disk_config.device_modifications: - for part in mod.partitions: - if part in pvs or part.fs_type is None: - continue - - self._prepare_fs_type(part.fs_type, part.mountpoint) - - if part in self._disk_encryption.partitions: - self._prepare_encrypt() - - def _handle_lvm_installation(self) -> None: - if not self._disk_config.lvm_config: - return - - self.add_additional_packages('lvm2') - self._hooks.insert(self._hooks.index('filesystems') - 1, 'lvm2') - - for vg in self._disk_config.lvm_config.vol_groups: - for vol in vg.volumes: - if vol.fs_type is not None: - self._prepare_fs_type(vol.fs_type, vol.mountpoint) - - if self._disk_encryption.encryption_type in [disk.EncryptionType.LvmOnLuks, disk.EncryptionType.LuksOnLvm]: - self._prepare_encrypt('lvm2') - def minimal_installation( self, testing: bool = False, @@ -811,9 +781,28 @@ class Installer: locale_config: LocaleConfiguration = LocaleConfiguration.default() ): if self._disk_config.lvm_config: - self._handle_lvm_installation() + lvm = 'lvm2' + self.add_additional_packages(lvm) + self._hooks.insert(self._hooks.index('filesystems') - 1, lvm) + + for vg in self._disk_config.lvm_config.vol_groups: + for vol in vg.volumes: + if vol.fs_type is not None: + self._prepare_fs_type(vol.fs_type, vol.mountpoint) + + types = (disk.EncryptionType.LvmOnLuks, disk.EncryptionType.LuksOnLvm) + if self._disk_encryption.encryption_type in types: + self._prepare_encrypt(lvm) else: - self._handle_partition_installation() + for mod in self._disk_config.device_modifications: + for part in mod.partitions: + if part.fs_type is None: + continue + + self._prepare_fs_type(part.fs_type, part.mountpoint) + + if part in self._disk_encryption.partitions: + self._prepare_encrypt() if not SysInfo.has_uefi(): self._base_packages.append('grub')