New partition replace check.
This commit is contained in:
parent
cef77d72e1
commit
935c4816d3
@ -34,6 +34,33 @@
|
|||||||
namespace PartUtils
|
namespace PartUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool
|
||||||
|
canBeReplaced( Partition* candidate )
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
|
->globalStorage()
|
||||||
|
->value( "requiredStorageGB" )
|
||||||
|
.toDouble( &ok );
|
||||||
|
|
||||||
|
qint64 availableStorageB = candidate->capacity();
|
||||||
|
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
||||||
|
cDebug() << "Required storage B:" << requiredStorageB
|
||||||
|
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
||||||
|
cDebug() << "Available storage B:" << availableStorageB
|
||||||
|
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
|
||||||
|
|
||||||
|
if ( ok &&
|
||||||
|
availableStorageB > requiredStorageB )
|
||||||
|
{
|
||||||
|
cDebug() << "Partition" << candidate->partitionPath() << "authorized for replace install.";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canBeResized( Partition* candidate )
|
canBeResized( Partition* candidate )
|
||||||
{
|
{
|
||||||
@ -51,7 +78,7 @@ canBeResized( Partition* candidate )
|
|||||||
|
|
||||||
// We require a little more for partitioning overhead and swap file
|
// We require a little more for partitioning overhead and swap file
|
||||||
// TODO: maybe make this configurable?
|
// TODO: maybe make this configurable?
|
||||||
qint64 requiredStorageB = ( requiredStorageGB + 0.1 + 2.0 ) * 1024 * 1024 * 1024;
|
qint64 requiredStorageB = ( requiredStorageGB + 0.5 + 2.0 ) * 1024 * 1024 * 1024;
|
||||||
cDebug() << "Required storage B:" << requiredStorageB
|
cDebug() << "Required storage B:" << requiredStorageB
|
||||||
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
||||||
cDebug() << "Available storage B:" << availableStorageB
|
cDebug() << "Available storage B:" << availableStorageB
|
||||||
|
@ -29,6 +29,8 @@ class Partition;
|
|||||||
namespace PartUtils
|
namespace PartUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool canBeReplaced( Partition* candidate );
|
||||||
|
|
||||||
bool canBeResized( Partition* candidate );
|
bool canBeResized( Partition* candidate );
|
||||||
|
|
||||||
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
||||||
|
Loading…
Reference in New Issue
Block a user