Use the new physical memory checker.
This commit is contained in:
parent
5e2f6ff2b8
commit
adad3535a8
@ -25,6 +25,7 @@
|
|||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
|
||||||
@ -245,15 +246,9 @@ RequirementsChecker::checkEnoughStorage( qint64 requiredSpace )
|
|||||||
bool
|
bool
|
||||||
RequirementsChecker::checkEnoughRam( qint64 requiredRam )
|
RequirementsChecker::checkEnoughRam( qint64 requiredRam )
|
||||||
{
|
{
|
||||||
// A line in meminfo looks like this, with {print $2} we grab the second column.
|
qint64 availableRam = CalamaresUtils::getPhysicalMemoryB();
|
||||||
// MemTotal: 8133432 kB
|
if ( !availableRam )
|
||||||
|
availableRam = CalamaresUtils::getTotalMemoryB();
|
||||||
QProcess p;
|
|
||||||
p.start( "awk", { "/MemTotal/ {print $2}", "/proc/meminfo" } );
|
|
||||||
p.waitForFinished();
|
|
||||||
QString memoryLine = p.readAllStandardOutput().simplified();
|
|
||||||
qint64 availableRam = memoryLine.toLongLong() * 1024;
|
|
||||||
|
|
||||||
return availableRam >= requiredRam * 0.95; // because MemTotal is variable
|
return availableRam >= requiredRam * 0.95; // because MemTotal is variable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user