mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-26 00:48:22 -04:00
Move ReplacePartition operation to PartitionActions.
This commit is contained in:
parent
f267410dbb
commit
8a6dcfbe2f
3 changed files with 26 additions and 11 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "GlobalStorage.h"
|
||||
|
||||
#include <kpmcore/core/device.h>
|
||||
#include <kpmcore/core/partition.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
|
@ -195,4 +196,25 @@ doAutopartition( PartitionCoreModule* core, Device* dev )
|
|||
core->dumpQueue();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition )
|
||||
{
|
||||
|
||||
Partition* newPartition = KPMHelpers::createNewPartition(
|
||||
partition->parent(),
|
||||
*dev,
|
||||
partition->roles(),
|
||||
FileSystem::Ext4,
|
||||
partition->firstSector(),
|
||||
partition->lastSector() );
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
PartitionInfo::setFormat( newPartition, true );
|
||||
|
||||
core->deletePartition( dev, partition );
|
||||
core->createPartition( dev, newPartition );
|
||||
|
||||
core->dumpQueue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
class PartitionCoreModule;
|
||||
class Device;
|
||||
class Partition;
|
||||
|
||||
namespace PartitionActions
|
||||
{
|
||||
void doAutopartition( PartitionCoreModule* core, Device* dev );
|
||||
void doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition );
|
||||
}
|
||||
|
||||
#endif // PARTITIONACTIONS_H
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/DeviceModel.h"
|
||||
#include "core/PartitionActions.h"
|
||||
|
||||
#include "JobQueue.h"
|
||||
#include "GlobalStorage.h"
|
||||
|
@ -109,18 +110,8 @@ ReplacePage::applyChanges()
|
|||
if ( partition )
|
||||
{
|
||||
Device* dev = model->device();
|
||||
Partition* newPartition = KPMHelpers::createNewPartition(
|
||||
partition->parent(),
|
||||
*dev,
|
||||
partition->roles(),
|
||||
FileSystem::Ext4,
|
||||
partition->firstSector(),
|
||||
partition->lastSector() );
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
PartitionInfo::setFormat( newPartition, true );
|
||||
|
||||
m_core->deletePartition( dev, partition );
|
||||
m_core->createPartition( dev, newPartition );
|
||||
PartitionActions::doReplacePartition( m_core, dev, partition );
|
||||
|
||||
if ( m_isEfi )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue