|
|
|
@ -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();
|
|
|
|
|