[partition] Add a config option for allowing zfs encryption

This commit is contained in:
dalto 2023-02-23 17:17:37 -06:00
parent d88d2ce92e
commit b7af2dd77d
8 changed files with 34 additions and 3 deletions

View File

@ -373,7 +373,7 @@ Config::fillConfigurationFSTypes( const QVariantMap& configurationMap )
luksGeneration = Config::LuksGeneration::Luks1; luksGeneration = Config::LuksGeneration::Luks1;
} }
m_luksFileSystemType = luksGeneration; m_luksFileSystemType = luksGeneration;
gs->insert( "luksFileSystemType", luksGenerationNames().find(luksGeneration) ); gs->insert( "luksFileSystemType", luksGenerationNames().find( luksGeneration ) );
Q_ASSERT( !m_eraseFsTypes.isEmpty() ); Q_ASSERT( !m_eraseFsTypes.isEmpty() );
Q_ASSERT( m_eraseFsTypes.contains( fsRealName ) ); Q_ASSERT( m_eraseFsTypes.contains( fsRealName ) );
@ -409,6 +409,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
} }
setSwapChoice( m_initialSwapChoice ); setSwapChoice( m_initialSwapChoice );
m_allowZfsEncryption = CalamaresUtils::getBool( configurationMap, "allowZfsEncryption", true );
m_allowManualPartitioning = CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ); m_allowManualPartitioning = CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true );
m_requiredPartitionTableType = CalamaresUtils::getStringList( configurationMap, "requiredPartitionTableType" ); m_requiredPartitionTableType = CalamaresUtils::getStringList( configurationMap, "requiredPartitionTableType" );

View File

@ -159,6 +159,9 @@ public:
*/ */
LuksGeneration luksFileSystemType() const { return m_luksFileSystemType; } LuksGeneration luksFileSystemType() const { return m_luksFileSystemType; }
/// @brief If zfs encryption should be allowed
bool allowZfsEncryption() const { return m_allowZfsEncryption; }
public Q_SLOTS: public Q_SLOTS:
void setInstallChoice( int ); ///< Translates a button ID or so to InstallChoice void setInstallChoice( int ); ///< Translates a button ID or so to InstallChoice
void setInstallChoice( InstallChoice ); void setInstallChoice( InstallChoice );
@ -189,7 +192,7 @@ private:
InstallChoice m_installChoice = NoChoice; InstallChoice m_installChoice = NoChoice;
qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module
QStringList m_requiredPartitionTableType; QStringList m_requiredPartitionTableType;
bool m_allowZfsEncryption = true;
bool m_allowManualPartitioning = true; bool m_allowManualPartitioning = true;
}; };

View File

@ -4,6 +4,7 @@
* SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2019 Collabora Ltd * SPDX-FileCopyrightText: 2019 Collabora Ltd
* SPDX-FileCopyrightText: 2021 Anubhav Choudhary <ac.10edu@gmail.com> * SPDX-FileCopyrightText: 2021 Anubhav Choudhary <ac.10edu@gmail.com>
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.
@ -1759,7 +1760,17 @@ ChoicePage::createBootloaderPanel()
bool bool
ChoicePage::shouldShowEncryptWidget( Config::InstallChoice choice ) const ChoicePage::shouldShowEncryptWidget( Config::InstallChoice choice ) const
{ {
bool suitableFS = true;
if ( !m_config->allowZfsEncryption()
&& ( ( m_eraseFsTypesChoiceComboBox && m_eraseFsTypesChoiceComboBox->isVisible()
&& m_eraseFsTypesChoiceComboBox->currentText() == "zfs" )
|| ( m_replaceFsTypesChoiceComboBox && m_replaceFsTypesChoiceComboBox->isVisible()
&& m_replaceFsTypesChoiceComboBox->currentText() == "zfs" ) ) )
{
suitableFS = false;
}
const bool suitableChoice const bool suitableChoice
= choice == InstallChoice::Erase || choice == InstallChoice::Alongside || choice == InstallChoice::Replace; = choice == InstallChoice::Erase || choice == InstallChoice::Alongside || choice == InstallChoice::Replace;
return suitableChoice && m_enableEncryptionWidget; return suitableChoice && m_enableEncryptionWidget && suitableFS;
} }

View File

@ -3,6 +3,7 @@
* SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org> * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2019 Collabora Ltd * SPDX-FileCopyrightText: 2019 Collabora Ltd
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.

View File

@ -2,6 +2,7 @@
* *
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org> * SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.

View File

@ -2,6 +2,7 @@
* *
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org> * SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.

View File

@ -78,6 +78,16 @@ userSwapChoices:
# #
luksGeneration: luks1 luksGeneration: luks1
# This setting determines if encryption should be allowed when using zfs. This
# setting has no effect unless zfs support is provided.
#
# This setting is to handle the fact that some bootloaders(such as grub) do not
# support zfs encryption.
#
# The default is true
#
# allowZfsEncryption: true
# Correctly draw nested (e.g. logical) partitions as such. # Correctly draw nested (e.g. logical) partitions as such.
drawNestedPartitions: false drawNestedPartitions: false

View File

@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> # SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
--- ---
$schema: https://json-schema.org/schema# $schema: https://json-schema.org/schema#
@ -14,6 +15,7 @@ properties:
# ensureSuspendToDisk: { type: boolean, default: true } # Legacy # ensureSuspendToDisk: { type: boolean, default: true } # Legacy
# neverCreateSwap: { type: boolean, default: false } # Legacy # neverCreateSwap: { type: boolean, default: false } # Legacy
allowZfsEncryption: { type: boolean, default: true }
drawNestedPartitions: { type: boolean, default: false } drawNestedPartitions: { type: boolean, default: false }
alwaysShowPartitionLabels: { type: boolean, default: true } alwaysShowPartitionLabels: { type: boolean, default: true }