mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
Don't fail when trying to replace unallocated space.
This commit is contained in:
parent
3ff23e8bc4
commit
24c1bf429e
1 changed files with 15 additions and 1 deletions
|
@ -201,10 +201,23 @@ void
|
|||
doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition )
|
||||
{
|
||||
cDebug() << "doReplacePartition for device" << partition->partitionPath();
|
||||
|
||||
PartitionRole newRoles( partition->roles() );
|
||||
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||
newRoles = PartitionRole( PartitionRole::Primary );
|
||||
|
||||
if ( partition->roles().has( PartitionRole::Unallocated ) )
|
||||
{
|
||||
newRoles = PartitionRole( PartitionRole::Primary );
|
||||
cDebug() << "WARNING: selected partition is free space";
|
||||
if ( partition->parent() )
|
||||
{
|
||||
Partition* parent = dynamic_cast< Partition* >( partition->parent() );
|
||||
if ( parent && parent->roles().has( PartitionRole::Extended ) )
|
||||
newRoles = PartitionRole( PartitionRole::Logical );
|
||||
}
|
||||
}
|
||||
|
||||
Partition* newPartition = KPMHelpers::createNewPartition(
|
||||
partition->parent(),
|
||||
*dev,
|
||||
|
@ -215,7 +228,8 @@ doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition
|
|||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
PartitionInfo::setFormat( newPartition, true );
|
||||
|
||||
core->deletePartition( dev, partition );
|
||||
if ( !partition->roles().has( PartitionRole::Unallocated ) )
|
||||
core->deletePartition( dev, partition );
|
||||
core->createPartition( dev, newPartition );
|
||||
|
||||
core->dumpQueue();
|
||||
|
|
Loading…
Add table
Reference in a new issue