[partition] Put EFI settings in a sub-map
This commit is contained in:
parent
eb08c3facd
commit
85350e63ef
@ -274,38 +274,66 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
|
||||
QString firmwareType( PartUtils::isEfiSystem() ? QStringLiteral( "efi" ) : QStringLiteral( "bios" ) );
|
||||
gs->insert( "firmwareType", firmwareType );
|
||||
|
||||
gs->insert( "efiSystemPartition",
|
||||
Calamares::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) );
|
||||
bool ok = false;
|
||||
auto efiConfiguration = Calamares::getSubMap( configurationMap, "efi", ok );
|
||||
|
||||
// Read and parse key efiSystemPartitionSize
|
||||
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
|
||||
// Mount Point
|
||||
{
|
||||
const QString sizeString = Calamares::getString( configurationMap, "efiSystemPartitionSize" );
|
||||
Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( sizeString );
|
||||
if ( part_size.isValid() )
|
||||
{
|
||||
// Insert once as string, once as a size-in-bytes;
|
||||
// changes to these keys should be synchronized with PartUtils.cpp
|
||||
gs->insert( PartUtils::efiFilesystemRecommendedSizeGSKey(), part_size.toBytes() );
|
||||
const auto efiSystemPartition = Calamares::getString(
|
||||
efiConfiguration,
|
||||
"mountPoint",
|
||||
Calamares::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) );
|
||||
// This specific GS key is also used by bootloader and grubcfg modules,
|
||||
// as well as partition module internalls.
|
||||
gs->insert( "efiSystemPartition", efiSystemPartition );
|
||||
}
|
||||
|
||||
// Assign long long int to long unsigned int to prevent compilation warning
|
||||
auto byte_part_size = part_size.toBytes();
|
||||
if ( byte_part_size != PartUtils::efiFilesystemRecommendedSize() )
|
||||
// Sizes
|
||||
{
|
||||
const auto efiRecommendedSize = Calamares::getString(
|
||||
efiConfiguration, "recommendedSize", Calamares::getString( configurationMap, "efiSystemPartitionSize" ) );
|
||||
if ( !efiRecommendedSize.isEmpty() )
|
||||
{
|
||||
Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( efiRecommendedSize );
|
||||
if ( part_size.isValid() )
|
||||
{
|
||||
cWarning() << "EFI partition size" << sizeString << "has been adjusted to"
|
||||
<< PartUtils::efiFilesystemRecommendedSize() << "bytes";
|
||||
gs->insert( PartUtils::efiFilesystemRecommendedSizeGSKey(), part_size.toBytes() );
|
||||
|
||||
// Assign long long int to long unsigned int to prevent compilation warning,
|
||||
// checks for loss-of-precision in the conversion.
|
||||
auto byte_part_size = part_size.toBytes();
|
||||
if ( byte_part_size != PartUtils::efiFilesystemRecommendedSize() )
|
||||
{
|
||||
cWarning() << "EFI partition size" << efiRecommendedSize << "has been adjusted to"
|
||||
<< PartUtils::efiFilesystemRecommendedSize() << "bytes";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "EFI partition size" << efiRecommendedSize << "is invalid, ignored";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
const auto efiMinimumSize = Calamares::getString( efiConfiguration, "minimumSize" );
|
||||
if ( !efiMinimumSize.isEmpty() )
|
||||
{
|
||||
cWarning() << "EFI partition size" << sizeString << "is invalid, ignored";
|
||||
Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( efiRecommendedSize );
|
||||
if ( part_size.isValid() )
|
||||
{
|
||||
gs->insert( PartUtils::efiFilesystemMinimumSizeGSKey(), part_size.toBytes() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read and parse key efiSystemPartitionName
|
||||
if ( configurationMap.contains( "efiSystemPartitionName" ) )
|
||||
// Name (label) of partition
|
||||
{
|
||||
gs->insert( "efiSystemPartitionName", Calamares::getString( configurationMap, "efiSystemPartitionName" ) );
|
||||
const auto efiLabel = Calamares::getString(
|
||||
efiConfiguration, "label", Calamares::getString( configurationMap, "efiSystemPartitionName" ) );
|
||||
|
||||
if ( !efiLabel.isEmpty() )
|
||||
{
|
||||
gs->insert( "efiSystemPartitionName", efiLabel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,28 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# This setting specifies the mount point of the EFI system partition. Some
|
||||
# distributions (Fedora, Debian, Manjaro, etc.) use /boot/efi, others (KaOS,
|
||||
# etc.) use just /boot.
|
||||
#
|
||||
# Defaults to "/boot/efi", may be empty (but weird effects ensue)
|
||||
efiSystemPartition: "/boot/efi"
|
||||
|
||||
# This optional setting specifies the size of the EFI system partition.
|
||||
# If nothing is specified, the default size of 300MiB will be used.
|
||||
# Options for EFI system partition.
|
||||
#
|
||||
# 300MiB is the default, and when writing quantities here, M is treated
|
||||
# as MiB, and if you really want one-million (10^6) bytes, use MB.
|
||||
# - *mountPoint*
|
||||
# This setting specifies the mount point of the EFI system partition. Some
|
||||
# distributions (Fedora, Debian, Manjaro, etc.) use /boot/efi, others (KaOS,
|
||||
# etc.) use just /boot.
|
||||
#
|
||||
# Defaults to "/boot/efi", may be empty (but weird effects ensue)
|
||||
# - *recommendedSize*
|
||||
# This optional setting specifies the size of the EFI system partition.
|
||||
# If nothing is specified, the default size of 300MiB will be used.
|
||||
# When writing quantities here, M is treated as MiB, and if you really
|
||||
# want one-million (10^6) bytes, use MB.
|
||||
# - *minimumSize*
|
||||
# This optional setting specifies the absolute minimum size of the EFI
|
||||
# system partition. If nothing is specified, the *recommendedSize*
|
||||
# is used instead.
|
||||
# - *label*
|
||||
# This optional setting specifies the name of the EFI system partition (see
|
||||
# PARTLABEL; gpt only; requires KPMCore >= 4.2.0).
|
||||
# If nothing is specified, the partition name is left unset.
|
||||
#
|
||||
# Going below the *recommended* size is allowed, but the user will
|
||||
# get a warning that it might not work. Going below the *minimum*
|
||||
@ -22,15 +32,18 @@ efiSystemPartition: "/boot/efi"
|
||||
# spec. If minimum is not specified, it defaults to the recommended
|
||||
# size. Distro's that allow more user latitude can set the minimum lower.
|
||||
efi:
|
||||
mountPoint: "/boot/efi"
|
||||
recommendedSize: 300MiB
|
||||
minimumSize: 32MiB
|
||||
label: "EFI"
|
||||
|
||||
# This is a deprecated alias of efi.recommendedSize
|
||||
# Deprecated alias of efi.mountPoint
|
||||
# efiSystemPartition: "/boot/efi"
|
||||
|
||||
# Deprecated alias of efi.recommendedSize
|
||||
# efiSystemPartitionSize: 300MiB
|
||||
|
||||
# This optional setting specifies the name of the EFI system partition (see
|
||||
# PARTLABEL; gpt only; requires KPMCore >= 4.2.0).
|
||||
# If nothing is specified, the partition name is left unset.
|
||||
# Deprecated alias of efi.label
|
||||
# efiSystemPartitionName: EFI
|
||||
|
||||
# In autogenerated partitioning, allow the user to select a swap size?
|
||||
|
@ -7,15 +7,17 @@ $id: https://calamares.io/schemas/partition
|
||||
additionalProperties: false
|
||||
type: object
|
||||
properties:
|
||||
efiSystemPartition: { type: string } # Mount point
|
||||
efiSystemPartition: { type: string } # Deprecated alias of efi.mountPoint
|
||||
efiSystemPartitionSize: { type: string } # Deprecated alias of efi.recommendedSize
|
||||
efiSystemPartitionName: { type: string }
|
||||
efiSystemPartitionName: { type: string } # Deprecated alias of efi.label
|
||||
|
||||
efi:
|
||||
type: object
|
||||
properties:
|
||||
recommendedSize: { type: string }
|
||||
minimumSize: { type: string }
|
||||
label: { type: string }
|
||||
mountPoint: { type: string }
|
||||
additionalProperties: false
|
||||
|
||||
userSwapChoices: { type: array, items: { type: string, enum: [ none, reuse, small, suspend, file ] } }
|
||||
@ -41,5 +43,4 @@ properties:
|
||||
|
||||
requiredStorage: { type: number }
|
||||
required:
|
||||
- efiSystemPartition
|
||||
- userSwapChoices
|
||||
|
Loading…
Reference in New Issue
Block a user