mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 03:15:44 -05:00
Split out a canBeResized overload that takes a Partition*.
This commit is contained in:
parent
984bc7ac08
commit
01eede3f6e
2 changed files with 38 additions and 27 deletions
|
@ -34,6 +34,40 @@
|
||||||
namespace PartUtils
|
namespace PartUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool
|
||||||
|
canBeResized( Partition* candidate )
|
||||||
|
{
|
||||||
|
if ( !candidate->fileSystem().supportGrow() ||
|
||||||
|
!candidate->fileSystem().supportShrink() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
|
->globalStorage()
|
||||||
|
->value( "requiredStorageGB" )
|
||||||
|
.toDouble( &ok );
|
||||||
|
|
||||||
|
qint64 availableStorageB = candidate->available();
|
||||||
|
|
||||||
|
// We require a little more for partitioning overhead and swap file
|
||||||
|
// TODO: maybe make this configurable?
|
||||||
|
qint64 requiredStorageB = ( requiredStorageGB + 0.1 + 2.0 ) * 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 resize + autopartition install.";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||||
{
|
{
|
||||||
|
@ -52,33 +86,7 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||||
if ( candidate )
|
if ( candidate )
|
||||||
{
|
{
|
||||||
cDebug() << "found Partition* for" << partitionWithOs;
|
cDebug() << "found Partition* for" << partitionWithOs;
|
||||||
if ( !candidate->fileSystem().supportGrow() ||
|
return canBeResized( candidate );
|
||||||
!candidate->fileSystem().supportShrink() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool ok = false;
|
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
|
||||||
->globalStorage()
|
|
||||||
->value( "requiredStorageGB" )
|
|
||||||
.toDouble( &ok );
|
|
||||||
|
|
||||||
qint64 availableStorageB = candidate->available();
|
|
||||||
|
|
||||||
// We require a little more for partitioning overhead and swap file
|
|
||||||
// TODO: maybe make this configurable?
|
|
||||||
qint64 requiredStorageB = ( requiredStorageGB + 0.1 + 2.0 ) * 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" << partitionWithOs << "authorized for resize + autopartition install.";
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,13 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
|
class Partition;
|
||||||
|
|
||||||
namespace PartUtils
|
namespace PartUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool canBeResized( Partition* candidate );
|
||||||
|
|
||||||
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
||||||
|
|
||||||
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
||||||
|
|
Loading…
Add table
Reference in a new issue