[partition] Add support for zfs encryption when erase disk is selected

This commit is contained in:
dalto 2021-11-13 09:31:23 -06:00
parent 4bed079ebf
commit 8bdfcac0fb
2 changed files with 21 additions and 2 deletions

View File

@ -118,7 +118,6 @@ def mount_partition(root_mount_point, partition, partitions):
raise Exception("Internal error mounting zfs datasets")
for zfs_pool in zfs_pool_list:
libcalamares.utils.warning("Poolname: " + zfs_pool["poolName"] + " mountpoint: " + zfs_pool["mountpoint"])
if zfs_pool["mountpoint"] == partition["mountPoint"]:
pool_name = zfs_pool["poolName"]
ds_name = zfs_pool["dsName"];

View File

@ -296,7 +296,9 @@ PartitionLayout::createPartitions( Device* dev,
}
Partition* part = nullptr;
if ( luksPassphrase.isEmpty() )
// Encryption for zfs is handled in the zfs module
if ( luksPassphrase.isEmpty() || correctFS( entry.partFileSystem ) == FileSystem::Zfs )
{
part = KPMHelpers::createNewPartition( parent,
*dev,
@ -319,6 +321,24 @@ PartitionLayout::createPartitions( Device* dev,
luksPassphrase,
KPM_PARTITION_FLAG( None ) );
}
// For zfs, we need to make the passphrase available to later modules
if ( correctFS( entry.partFileSystem ) == FileSystem::Zfs )
{
Calamares::GlobalStorage* storage = Calamares::JobQueue::instance()->globalStorage();
QList< QVariant > zfsInfoList;
QVariantMap zfsInfo;
// Save the information subsequent modules will need
zfsInfo[ "encrypted" ] = !luksPassphrase.isEmpty();
zfsInfo[ "passphrase" ] = luksPassphrase;
zfsInfo[ "mountpoint" ] = entry.partMountPoint;
// Add it to the list and insert it into global storage
zfsInfoList.append( zfsInfo );
storage->insert( "zfsInfo", zfsInfoList );
}
PartitionInfo::setFormat( part, true );
PartitionInfo::setMountPoint( part, entry.partMountPoint );
if ( !entry.partLabel.isEmpty() )