From 36485c8571ecc432bb50db7857e5c6a39dd2f977 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Apr 2024 23:20:35 +0200 Subject: [PATCH] [partition] Simplify logic for checking for unencrypted /boot --- src/modules/partition/PartitionViewStep.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index 8b7225da3..8d9aae609 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -497,11 +497,12 @@ shouldWarnForNotEncryptedBoot( const Config* config, const PartitionCoreModule* Partition* root_p = core->findPartitionByMountPoint( "/" ); Partition* boot_p = core->findPartitionByMountPoint( "/boot" ); - if ( root_p and boot_p ) + if ( root_p && boot_p ) { - if ( ( root_p->fileSystem().type() == FileSystem::Luks && boot_p->fileSystem().type() != FileSystem::Luks ) - || ( root_p->fileSystem().type() == FileSystem::Luks2 - && boot_p->fileSystem().type() != FileSystem::Luks2 ) ) + const auto encryptionMismatch + = [ root_t = root_p->fileSystem().type(), boot_t = boot_p->fileSystem().type() ]( FileSystem::Type t ) + { return root_t == t && boot_t != t; }; + if ( encryptionMismatch( FileSystem::Luks ) || encryptionMismatch( FileSystem::Luks2 ) ) { return true; }