Merge branch 'calamares' into issues-1166

This commit is contained in:
Adriaan de Groot 2020-10-06 17:19:14 +02:00
commit b4cbf73e2d
148 changed files with 15502 additions and 15005 deletions

View file

@ -165,15 +165,14 @@ PartitionLayout::execute( Device* dev,
{
QList< Partition* > partList;
// Map each partition entry to its requested size (0 when calculated later)
QMap< const PartitionLayout::PartitionEntry*, qint64 > partSizeMap;
qint64 minSize, maxSize, end;
QMap< const PartitionLayout::PartitionEntry *, qint64 > partSizeMap;
qint64 totalSize = lastSector - firstSector + 1;
qint64 availableSize = totalSize;
// Let's check if we have enough space for each partSize
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
for( const auto& part : qAsConst(m_partLayout) )
{
qint64 size = -1;
qint64 size;
// Calculate partition size
if ( part.partSize.isValid() )
@ -209,7 +208,7 @@ PartitionLayout::execute( Device* dev,
if ( availableSize < 0 )
{
availableSize = totalSize;
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
for( const auto& part : qAsConst(m_partLayout) )
{
qint64 size;
@ -239,13 +238,12 @@ PartitionLayout::execute( Device* dev,
}
// Assign size for percentage-defined partitions
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
for( const auto& part : qAsConst(m_partLayout) )
{
if ( part.partSize.unit() == CalamaresUtils::Partition::SizeUnit::Percent )
{
qint64 size = partSizeMap.value( &part );
qint64 size = partSizeMap.value(&part);
size = part.partSize.toSectors( availableSize + size, dev->logicalSize() );
partSizeMap.insert( &part, size );
if ( part.partMinSize.isValid() )
{
qint64 minSize = part.partMinSize.toSectors( totalSize, dev->logicalSize() );
@ -262,6 +260,8 @@ PartitionLayout::execute( Device* dev,
size = maxSize;
}
}
partSizeMap.insert(&part, size);
}
}
@ -270,21 +270,20 @@ PartitionLayout::execute( Device* dev,
// TODO: Refine partition sizes to make sure there is room for every partition
// Use a default (200-500M ?) minimum size for partition without minSize
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
for( const auto& part : qAsConst(m_partLayout) )
{
qint64 size = partSizeMap.value( &part );
qint64 size, end;
Partition* currentPartition = nullptr;
// Adjust partition size based on user-defined boundaries and available space
if ( size > maxSize )
{
size = maxSize;
}
size = partSizeMap.value(&part);
// Adjust partition size based on available space
if ( size > availableSize )
{
size = availableSize;
}
end = firstSector + size - 1;
end = firstSector + std::max(size - 1, Q_INT64_C(0));
if ( luksPassphrase.isEmpty() )
{