From f0fb39edd873c95ba7ed0aee60f01af7e805b932 Mon Sep 17 00:00:00 2001 From: Brian Morison <777373+bkmo@users.noreply.github.com> Date: Sun, 20 Aug 2023 13:07:58 -0600 Subject: [PATCH 1/3] Update LuksBootKeyFileJob.cpp --- src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp index c9c0e1298..247237898 100644 --- a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp +++ b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp @@ -302,6 +302,14 @@ LuksBootKeyFileJob::exec() return Calamares::JobResult::ok(); } + if ( hasUnencryptedSeparateBoot() && hasEncryptedRoot() ) + { + // /boot partition is not encrypted, keyfile must not be used + // But only if root partition is encrypted + cDebug() << Logger::SubEntry << "/boot partition is not encrypted, skipping keyfile creation."; + return Calamares::JobResult::ok(); + } + if ( s.devices.first().passphrase.isEmpty() ) { cDebug() << Logger::SubEntry << "No root passphrase."; From ab8159a77fbed6825511df1a1a5dd112c518b517 Mon Sep 17 00:00:00 2001 From: Brian Morison <777373+bkmo@users.noreply.github.com> Date: Sun, 20 Aug 2023 13:28:06 -0600 Subject: [PATCH 2/3] Update LuksBootKeyFileJob.cpp --- .../luksbootkeyfile/LuksBootKeyFileJob.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp index 247237898..891db9663 100644 --- a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp +++ b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp @@ -294,22 +294,13 @@ LuksBootKeyFileJob::exec() return Calamares::JobResult::ok(); } - if ( hasUnencryptedSeparateBoot() && !hasEncryptedRoot() ) + if ( hasUnencryptedSeparateBoot() ) { - // /boot partition is not encrypted, keyfile must not be used - // But only if root partition is not encrypted + // /boot partition is not encrypted, keyfile must not be used. cDebug() << Logger::SubEntry << "/boot partition is not encrypted, skipping keyfile creation."; return Calamares::JobResult::ok(); } - - if ( hasUnencryptedSeparateBoot() && hasEncryptedRoot() ) - { - // /boot partition is not encrypted, keyfile must not be used - // But only if root partition is encrypted - cDebug() << Logger::SubEntry << "/boot partition is not encrypted, skipping keyfile creation."; - return Calamares::JobResult::ok(); - } - + if ( s.devices.first().passphrase.isEmpty() ) { cDebug() << Logger::SubEntry << "No root passphrase."; From b5e0ebe4c9be7a1700f41fb0a3ed66f73679bc1d Mon Sep 17 00:00:00 2001 From: dalto Date: Sat, 26 Aug 2023 14:15:18 -0500 Subject: [PATCH 3/3] [luksBootKeyFile] Remove unused function hasEncryptedRoot() --- src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp | 9 +-------- src/modules/luksbootkeyfile/Tests.cpp | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp index 891db9663..83f95ab30 100644 --- a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp +++ b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp @@ -242,13 +242,6 @@ hasUnencryptedSeparateBoot() { return hasMountPoint( partition, QStringLiteral( "/boot" ) ) && !isEncrypted( partition ); } ); } -STATICTEST bool -hasEncryptedRoot() -{ - return anyPartition( []( const QVariantMap& partition ) - { return hasMountPoint( partition, QStringLiteral( "/" ) ) && isEncrypted( partition ); } ); -} - Calamares::JobResult LuksBootKeyFileJob::exec() { @@ -300,7 +293,7 @@ LuksBootKeyFileJob::exec() cDebug() << Logger::SubEntry << "/boot partition is not encrypted, skipping keyfile creation."; return Calamares::JobResult::ok(); } - + if ( s.devices.first().passphrase.isEmpty() ) { cDebug() << Logger::SubEntry << "No root passphrase."; diff --git a/src/modules/luksbootkeyfile/Tests.cpp b/src/modules/luksbootkeyfile/Tests.cpp index 6b6c7be81..07eacd8a9 100644 --- a/src/modules/luksbootkeyfile/Tests.cpp +++ b/src/modules/luksbootkeyfile/Tests.cpp @@ -158,7 +158,6 @@ LuksBootKeyFileTests::testAnyPartition() { return hasMountPoint( partdata, QStringLiteral( "/" ) ); } ) ); QVERIFY( !anyPartition( []( const QVariantMap& partdata ) { return hasMountPoint( partdata, QString() ); } ) ); - QVERIFY( !hasEncryptedRoot() ); QVERIFY( hasUnencryptedSeparateBoot() ); }