commit
bbd2afc20f
@ -74,7 +74,7 @@ canBeReplaced( Partition* candidate )
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
->globalStorage()
|
->globalStorage()
|
||||||
->value( "requiredStorageGB" )
|
->value( "requiredStorageGiB" )
|
||||||
.toDouble( &ok );
|
.toDouble( &ok );
|
||||||
|
|
||||||
qint64 availableStorageB = candidate->capacity();
|
qint64 availableStorageB = candidate->capacity();
|
||||||
@ -146,7 +146,7 @@ canBeResized( Partition* candidate )
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
->globalStorage()
|
->globalStorage()
|
||||||
->value( "requiredStorageGB" )
|
->value( "requiredStorageGiB" )
|
||||||
.toDouble( &ok );
|
.toDouble( &ok );
|
||||||
// We require a little more for partitioning overhead and swap file
|
// We require a little more for partitioning overhead and swap file
|
||||||
double advisedStorageGB = requiredStorageGB + 0.5 + 2.0;
|
double advisedStorageGB = requiredStorageGB + 0.5 + 2.0;
|
||||||
|
@ -98,7 +98,7 @@ PartitionIterator::begin( PartitionTable* table )
|
|||||||
{
|
{
|
||||||
auto it = PartitionIterator( table );
|
auto it = PartitionIterator( table );
|
||||||
QList< Partition* > children = table->children();
|
QList< Partition* > children = table->children();
|
||||||
// Does not usually happen, but it did happen on a 10MB disk with an MBR
|
// Does not usually happen, but it did happen on a tiny (10MiB) disk with an MBR
|
||||||
// partition table.
|
// partition table.
|
||||||
if ( children.isEmpty() )
|
if ( children.isEmpty() )
|
||||||
return it;
|
return it;
|
||||||
|
@ -462,7 +462,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
|||||||
gs->value( "defaultFileSystemType" ).toString(),
|
gs->value( "defaultFileSystemType" ).toString(),
|
||||||
m_encryptWidget->passphrase(),
|
m_encryptWidget->passphrase(),
|
||||||
gs->value( "efiSystemPartition" ).toString(),
|
gs->value( "efiSystemPartition" ).toString(),
|
||||||
CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() ),
|
CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGiB" ).toDouble() ),
|
||||||
m_eraseSwapChoice
|
m_eraseSwapChoice
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -560,11 +560,10 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current,
|
|||||||
|
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
->globalStorage()
|
->globalStorage()
|
||||||
->value( "requiredStorageGB" )
|
->value( "requiredStorageGiB" )
|
||||||
.toDouble();
|
.toDouble();
|
||||||
|
|
||||||
// TODO: make this consistent
|
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes( requiredStorageGB + 0.1 + 2.0 );
|
||||||
qint64 requiredStorageB = qRound64( requiredStorageGB + 0.1 + 2.0 ) * 1024 * 1024 * 1024;
|
|
||||||
|
|
||||||
m_afterPartitionSplitterWidget->setSplitPartition(
|
m_afterPartitionSplitterWidget->setSplitPartition(
|
||||||
part->partitionPath(),
|
part->partitionPath(),
|
||||||
@ -967,11 +966,11 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
|||||||
qint64 sizeNext )
|
qint64 sizeNext )
|
||||||
{
|
{
|
||||||
Q_UNUSED( path )
|
Q_UNUSED( path )
|
||||||
sizeLabel->setText( tr( "%1 will be shrunk to %2MB and a new "
|
sizeLabel->setText( tr( "%1 will be shrunk to %2MiB and a new "
|
||||||
"%3MB partition will be created for %4." )
|
"%3MiB partition will be created for %4." )
|
||||||
.arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() )
|
.arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() )
|
||||||
.arg( size / ( 1024 * 1024 ) )
|
.arg( CalamaresUtils::BytesToMiB( size ) )
|
||||||
.arg( sizeNext / ( 1024 * 1024 ) )
|
.arg( CalamaresUtils::BytesToMiB( sizeNext ) )
|
||||||
.arg( *Calamares::Branding::ShortProductName ) );
|
.arg( *Calamares::Branding::ShortProductName ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
#include "PartitionLabelsView.h"
|
#include "PartitionLabelsView.h"
|
||||||
|
|
||||||
#include <core/PartitionModel.h>
|
#include "core/PartitionModel.h"
|
||||||
#include <core/ColorUtils.h>
|
#include "core/ColorUtils.h"
|
||||||
|
|
||||||
#include <utils/CalamaresUtilsGui.h>
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include <utils/Logger.h>
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/Units.h"
|
||||||
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/fs/filesystem.h>
|
#include <kpmcore/fs/filesystem.h>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
using CalamaresUtils::operator""_MiB;
|
||||||
|
|
||||||
static const int LAYOUT_MARGIN = 4;
|
static const int LAYOUT_MARGIN = 4;
|
||||||
static const int LABEL_PARTITION_SQUARE_MARGIN =
|
static const int LABEL_PARTITION_SQUARE_MARGIN =
|
||||||
@ -62,12 +64,6 @@ PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
|||||||
setSelectionBehavior( QAbstractItemView::SelectRows );
|
setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
this->setObjectName("partitionLabel");
|
this->setObjectName("partitionLabel");
|
||||||
// Debug
|
|
||||||
connect( this, &PartitionLabelsView::clicked,
|
|
||||||
this, [=]( const QModelIndex& index )
|
|
||||||
{
|
|
||||||
cDebug() << "Clicked row" << index.row();
|
|
||||||
} );
|
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +158,8 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const
|
|||||||
|
|
||||||
//HACK: horrible special casing follows.
|
//HACK: horrible special casing follows.
|
||||||
// To save vertical space, we choose to hide short instances of free space.
|
// To save vertical space, we choose to hide short instances of free space.
|
||||||
// Arbitrary limit: 10MB.
|
// Arbitrary limit: 10MiB.
|
||||||
const qint64 maxHiddenB = 10000000;
|
const qint64 maxHiddenB = 10_MiB;
|
||||||
if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() &&
|
if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() &&
|
||||||
index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB )
|
index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB )
|
||||||
continue;
|
continue;
|
||||||
|
@ -143,7 +143,7 @@ ReplaceWidget::onPartitionSelected()
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredSpaceB = Calamares::JobQueue::instance()
|
double requiredSpaceB = Calamares::JobQueue::instance()
|
||||||
->globalStorage()
|
->globalStorage()
|
||||||
->value( "requiredStorageGB" )
|
->value( "requiredStorageGiB" )
|
||||||
.toDouble( &ok ) * 1024 * 1024 * 1024;
|
.toDouble( &ok ) * 1024 * 1024 * 1024;
|
||||||
|
|
||||||
PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() );
|
PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() );
|
||||||
|
@ -41,7 +41,7 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
|
|||||||
QString
|
QString
|
||||||
CreatePartitionJob::prettyName() const
|
CreatePartitionJob::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Create new %2MB partition on %4 (%3) with file system %1." )
|
return tr( "Create new %2MiB partition on %4 (%3) with file system %1." )
|
||||||
.arg( m_partition->fileSystem().name() )
|
.arg( m_partition->fileSystem().name() )
|
||||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||||
.arg( m_device->name() )
|
.arg( m_device->name() )
|
||||||
@ -52,7 +52,7 @@ CreatePartitionJob::prettyName() const
|
|||||||
QString
|
QString
|
||||||
CreatePartitionJob::prettyDescription() const
|
CreatePartitionJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
return tr( "Create new <strong>%2MB</strong> partition on <strong>%4</strong> "
|
return tr( "Create new <strong>%2MiB</strong> partition on <strong>%4</strong> "
|
||||||
"(%3) with file system <strong>%1</strong>." )
|
"(%3) with file system <strong>%1</strong>." )
|
||||||
.arg( m_partition->fileSystem().name() )
|
.arg( m_partition->fileSystem().name() )
|
||||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||||
|
@ -38,7 +38,7 @@ FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
|||||||
QString
|
QString
|
||||||
FormatPartitionJob::prettyName() const
|
FormatPartitionJob::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Format partition %1 (file system: %2, size: %3 MB) on %4." )
|
return tr( "Format partition %1 (file system: %2, size: %3 MiB) on %4." )
|
||||||
.arg( m_partition->partitionPath() )
|
.arg( m_partition->partitionPath() )
|
||||||
.arg( m_partition->fileSystem().name() )
|
.arg( m_partition->fileSystem().name() )
|
||||||
.arg( m_partition->capacity() / 1024 / 1024 )
|
.arg( m_partition->capacity() / 1024 / 1024 )
|
||||||
@ -49,7 +49,7 @@ FormatPartitionJob::prettyName() const
|
|||||||
QString
|
QString
|
||||||
FormatPartitionJob::prettyDescription() const
|
FormatPartitionJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
return tr( "Format <strong>%3MB</strong> partition <strong>%1</strong> with "
|
return tr( "Format <strong>%3MiB</strong> partition <strong>%1</strong> with "
|
||||||
"file system <strong>%2</strong>." )
|
"file system <strong>%2</strong>." )
|
||||||
.arg( m_partition->partitionPath() )
|
.arg( m_partition->partitionPath() )
|
||||||
.arg( m_partition->fileSystem().name() )
|
.arg( m_partition->fileSystem().name() )
|
||||||
|
@ -52,8 +52,8 @@ ResizePartitionJob::prettyName() const
|
|||||||
QString
|
QString
|
||||||
ResizePartitionJob::prettyDescription() const
|
ResizePartitionJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
return tr( "Resize <strong>%2MB</strong> partition <strong>%1</strong> to "
|
return tr( "Resize <strong>%2MiB</strong> partition <strong>%1</strong> to "
|
||||||
"<strong>%3MB</strong>." )
|
"<strong>%3MiB</strong>." )
|
||||||
.arg( partition()->partitionPath() )
|
.arg( partition()->partitionPath() )
|
||||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||||
@ -63,8 +63,8 @@ ResizePartitionJob::prettyDescription() const
|
|||||||
QString
|
QString
|
||||||
ResizePartitionJob::prettyStatusMessage() const
|
ResizePartitionJob::prettyStatusMessage() const
|
||||||
{
|
{
|
||||||
return tr( "Resizing %2MB partition %1 to "
|
return tr( "Resizing %2MiB partition %1 to "
|
||||||
"%3MB." )
|
"%3MiB." )
|
||||||
.arg( partition()->partitionPath() )
|
.arg( partition()->partitionPath() )
|
||||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||||
|
@ -49,7 +49,7 @@ SetPartFlagsJob::prettyName() const
|
|||||||
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
|
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
|
||||||
|
|
||||||
if ( !partition()->fileSystem().name().isEmpty() )
|
if ( !partition()->fileSystem().name().isEmpty() )
|
||||||
return tr( "Set flags on %1MB %2 partition." )
|
return tr( "Set flags on %1MiB %2 partition." )
|
||||||
.arg( BytesToMiB( partition()->capacity() ) )
|
.arg( BytesToMiB( partition()->capacity() ) )
|
||||||
.arg( partition()->fileSystem().name() );
|
.arg( partition()->fileSystem().name() );
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ SetPartFlagsJob::prettyDescription() const
|
|||||||
.arg( partition()->partitionPath() );
|
.arg( partition()->partitionPath() );
|
||||||
|
|
||||||
if ( !partition()->fileSystem().name().isEmpty() )
|
if ( !partition()->fileSystem().name().isEmpty() )
|
||||||
return tr( "Clear flags on %1MB <strong>%2</strong> partition." )
|
return tr( "Clear flags on %1MiB <strong>%2</strong> partition." )
|
||||||
.arg( BytesToMiB( partition()->capacity() ) )
|
.arg( BytesToMiB( partition()->capacity() ) )
|
||||||
.arg( partition()->fileSystem().name() );
|
.arg( partition()->fileSystem().name() );
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ SetPartFlagsJob::prettyDescription() const
|
|||||||
.arg( flagsList.join( ", " ) );
|
.arg( flagsList.join( ", " ) );
|
||||||
|
|
||||||
if ( !partition()->fileSystem().name().isEmpty() )
|
if ( !partition()->fileSystem().name().isEmpty() )
|
||||||
return tr( "Flag %1MB <strong>%2</strong> partition as "
|
return tr( "Flag %1MiB <strong>%2</strong> partition as "
|
||||||
"<strong>%3</strong>." )
|
"<strong>%3</strong>." )
|
||||||
.arg( BytesToMiB( partition()->capacity() ) )
|
.arg( BytesToMiB( partition()->capacity() ) )
|
||||||
.arg( partition()->fileSystem().name() )
|
.arg( partition()->fileSystem().name() )
|
||||||
@ -104,7 +104,7 @@ SetPartFlagsJob::prettyStatusMessage() const
|
|||||||
.arg( partition()->partitionPath() );
|
.arg( partition()->partitionPath() );
|
||||||
|
|
||||||
if ( !partition()->fileSystem().name().isEmpty() )
|
if ( !partition()->fileSystem().name().isEmpty() )
|
||||||
return tr( "Clearing flags on %1MB <strong>%2</strong> partition." )
|
return tr( "Clearing flags on %1MiB <strong>%2</strong> partition." )
|
||||||
.arg( BytesToMiB( partition()->capacity() ) )
|
.arg( BytesToMiB( partition()->capacity() ) )
|
||||||
.arg( partition()->fileSystem().name() );
|
.arg( partition()->fileSystem().name() );
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ SetPartFlagsJob::prettyStatusMessage() const
|
|||||||
|
|
||||||
if ( !partition()->fileSystem().name().isEmpty() )
|
if ( !partition()->fileSystem().name().isEmpty() )
|
||||||
return tr( "Setting flags <strong>%3</strong> on "
|
return tr( "Setting flags <strong>%3</strong> on "
|
||||||
"%1MB <strong>%2</strong> partition." )
|
"%1MiB <strong>%2</strong> partition." )
|
||||||
.arg( BytesToMiB( partition()->capacity() ) )
|
.arg( BytesToMiB( partition()->capacity() ) )
|
||||||
.arg( partition()->fileSystem().name() )
|
.arg( partition()->fileSystem().name() )
|
||||||
.arg( flagsList.join( ", " ) );
|
.arg( flagsList.join( ", " ) );
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
bool m_mounted;
|
bool m_mounted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @brief Generate random data of given @p size as a QByteArray
|
||||||
static QByteArray
|
static QByteArray
|
||||||
generateTestData( qint64 size )
|
generateTestData( qint64 size )
|
||||||
{
|
{
|
||||||
@ -321,10 +322,10 @@ PartitionJobTests::testCreatePartitionExtended()
|
|||||||
void
|
void
|
||||||
PartitionJobTests::testResizePartition_data()
|
PartitionJobTests::testResizePartition_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn< int >( "oldStartMB" );
|
QTest::addColumn< int >( "oldStartMiB" );
|
||||||
QTest::addColumn< int >( "oldSizeMB" );
|
QTest::addColumn< int >( "oldSizeMiB" );
|
||||||
QTest::addColumn< int >( "newStartMB" );
|
QTest::addColumn< int >( "newStartMiB" );
|
||||||
QTest::addColumn< int >( "newSizeMB" );
|
QTest::addColumn< int >( "newSizeMiB" );
|
||||||
|
|
||||||
QTest::newRow("grow") << 10 << 50 << 10 << 70;
|
QTest::newRow("grow") << 10 << 50 << 10 << 70;
|
||||||
QTest::newRow("shrink") << 10 << 70 << 10 << 50;
|
QTest::newRow("shrink") << 10 << 70 << 10 << 50;
|
||||||
@ -335,22 +336,22 @@ PartitionJobTests::testResizePartition_data()
|
|||||||
void
|
void
|
||||||
PartitionJobTests::testResizePartition()
|
PartitionJobTests::testResizePartition()
|
||||||
{
|
{
|
||||||
QFETCH( int, oldStartMB );
|
QFETCH( int, oldStartMiB );
|
||||||
QFETCH( int, oldSizeMB );
|
QFETCH( int, oldSizeMiB );
|
||||||
QFETCH( int, newStartMB );
|
QFETCH( int, newStartMiB );
|
||||||
QFETCH( int, newSizeMB );
|
QFETCH( int, newSizeMiB );
|
||||||
|
|
||||||
const qint64 sectorForMB = 1_MiB / m_device->logicalSize();
|
const qint64 sectorsPerMiB = 1_MiB / m_device->logicalSize();
|
||||||
|
|
||||||
qint64 oldFirst = sectorForMB * oldStartMB;
|
qint64 oldFirst = sectorsPerMiB * oldStartMiB;
|
||||||
qint64 oldLast = oldFirst + sectorForMB * oldSizeMB - 1;
|
qint64 oldLast = oldFirst + sectorsPerMiB * oldSizeMiB - 1;
|
||||||
qint64 newFirst = sectorForMB * newStartMB;
|
qint64 newFirst = sectorsPerMiB * newStartMiB;
|
||||||
qint64 newLast = newFirst + sectorForMB * newSizeMB - 1;
|
qint64 newLast = newFirst + sectorsPerMiB * newSizeMiB - 1;
|
||||||
|
|
||||||
// Make the test data file smaller than the full size of the partition to
|
// Make the test data file smaller than the full size of the partition to
|
||||||
// accomodate for the file system overhead
|
// accomodate for the file system overhead
|
||||||
const unsigned long long minSizeMB = qMin( oldSizeMB, newSizeMB );
|
const unsigned long long minSizeMiB = qMin( oldSizeMiB, newSizeMiB );
|
||||||
const QByteArray testData = generateTestData( CalamaresUtils::MiBtoBytes( minSizeMB ) * 3 / 4 );
|
const QByteArray testData = generateTestData( CalamaresUtils::MiBtoBytes( minSizeMiB ) * 3 / 4 );
|
||||||
const QString testName = "test.data";
|
const QString testName = "test.data";
|
||||||
|
|
||||||
// Setup: create the test partition
|
// Setup: create the test partition
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
|
|
||||||
GeneralRequirements::GeneralRequirements( QObject* parent )
|
GeneralRequirements::GeneralRequirements( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_requiredStorageGB( -1 )
|
, m_requiredStorageGiB( -1 )
|
||||||
, m_requiredRamGB( -1 )
|
, m_requiredRamGiB( -1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,12 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
|
|||||||
bool isRoot = false;
|
bool isRoot = false;
|
||||||
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight);
|
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight);
|
||||||
|
|
||||||
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGB);
|
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGiB);
|
||||||
cDebug() << "Need at least storage bytes:" << requiredStorageB;
|
cDebug() << "Need at least storage bytes:" << requiredStorageB;
|
||||||
if ( m_entriesToCheck.contains( "storage" ) )
|
if ( m_entriesToCheck.contains( "storage" ) )
|
||||||
enoughStorage = checkEnoughStorage( requiredStorageB );
|
enoughStorage = checkEnoughStorage( requiredStorageB );
|
||||||
|
|
||||||
qint64 requiredRamB = CalamaresUtils::GiBtoBytes(m_requiredRamGB);
|
qint64 requiredRamB = CalamaresUtils::GiBtoBytes(m_requiredRamGiB);
|
||||||
cDebug() << "Need at least ram bytes:" << requiredRamB;
|
cDebug() << "Need at least ram bytes:" << requiredRamB;
|
||||||
if ( m_entriesToCheck.contains( "ram" ) )
|
if ( m_entriesToCheck.contains( "ram" ) )
|
||||||
enoughRam = checkEnoughRam( requiredRamB );
|
enoughRam = checkEnoughRam( requiredRamB );
|
||||||
@ -105,16 +105,16 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
|
|||||||
if ( entry == "storage" )
|
if ( entry == "storage" )
|
||||||
checkEntries.append( {
|
checkEntries.append( {
|
||||||
entry,
|
entry,
|
||||||
[req=m_requiredStorageGB]{ return tr( "has at least %1 GB available drive space" ).arg( req ); },
|
[req=m_requiredStorageGiB]{ return tr( "has at least %1 GiB available drive space" ).arg( req ); },
|
||||||
[req=m_requiredStorageGB]{ return tr( "There is not enough drive space. At least %1 GB is required." ).arg( req ); },
|
[req=m_requiredStorageGiB]{ return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); },
|
||||||
enoughStorage,
|
enoughStorage,
|
||||||
m_entriesToRequire.contains( entry )
|
m_entriesToRequire.contains( entry )
|
||||||
} );
|
} );
|
||||||
else if ( entry == "ram" )
|
else if ( entry == "ram" )
|
||||||
checkEntries.append( {
|
checkEntries.append( {
|
||||||
entry,
|
entry,
|
||||||
[req=m_requiredRamGB]{ return tr( "has at least %1 GB working memory" ).arg( req ); },
|
[req=m_requiredRamGiB]{ return tr( "has at least %1 GiB working memory" ).arg( req ); },
|
||||||
[req=m_requiredRamGB]{ return tr( "The system does not have enough working memory. At least %1 GB is required." ).arg( req ); },
|
[req=m_requiredRamGiB]{ return tr( "The system does not have enough working memory. At least %1 GiB is required." ).arg( req ); },
|
||||||
enoughRam,
|
enoughRam,
|
||||||
m_entriesToRequire.contains( entry )
|
m_entriesToRequire.contains( entry )
|
||||||
} );
|
} );
|
||||||
@ -209,19 +209,19 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) )
|
configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid.";
|
cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid.";
|
||||||
m_requiredStorageGB = 3.;
|
m_requiredStorageGiB = 3.;
|
||||||
}
|
}
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "requiredStorageGB", m_requiredStorageGB );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "requiredStorageGiB", m_requiredStorageGiB );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cWarning() << "GeneralRequirements entry 'requiredStorage' is missing.";
|
cWarning() << "GeneralRequirements entry 'requiredStorage' is missing.";
|
||||||
m_requiredStorageGB = 3.;
|
m_requiredStorageGiB = 3.;
|
||||||
incompleteConfiguration = true;
|
incompleteConfiguration = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,18 +230,18 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
configurationMap.value( "requiredRam" ).type() == QVariant::Int ) )
|
configurationMap.value( "requiredRam" ).type() == QVariant::Int ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
cWarning() << "GeneralRequirements entry 'requiredRam' is invalid.";
|
cWarning() << "GeneralRequirements entry 'requiredRam' is invalid.";
|
||||||
m_requiredRamGB = 1.;
|
m_requiredRamGiB = 1.;
|
||||||
incompleteConfiguration = true;
|
incompleteConfiguration = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cWarning() << "GeneralRequirements entry 'requiredRam' is missing.";
|
cWarning() << "GeneralRequirements entry 'requiredRam' is missing.";
|
||||||
m_requiredRamGB = 1.;
|
m_requiredRamGiB = 1.;
|
||||||
incompleteConfiguration = true;
|
incompleteConfiguration = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ private:
|
|||||||
bool checkHasInternet();
|
bool checkHasInternet();
|
||||||
bool checkIsRoot();
|
bool checkIsRoot();
|
||||||
|
|
||||||
qreal m_requiredStorageGB;
|
qreal m_requiredStorageGiB;
|
||||||
qreal m_requiredRamGB;
|
qreal m_requiredRamGiB;
|
||||||
QString m_checkHasInternetUrl;
|
QString m_checkHasInternetUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ is_cdrom(const char *path)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = open(path, O_RDONLY | O_NONBLOCK);
|
fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||||
ioctl(fd, CDIOCCAPABILITY, NULL);
|
ioctl(fd, CDIOCCAPABILITY, NULL);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (errno != EBADF && errno != ENOTTY)
|
if (errno != EBADF && errno != ENOTTY)
|
||||||
@ -120,7 +120,7 @@ check_big_enough(long long required_space)
|
|||||||
for (dev = NULL; NULL != (dev = ped_device_get_next(dev));)
|
for (dev = NULL; NULL != (dev = ped_device_get_next(dev));)
|
||||||
{
|
{
|
||||||
long long dev_size = process_device(dev);
|
long long dev_size = process_device(dev);
|
||||||
if (dev_size > required_space)
|
if (dev_size >= required_space)
|
||||||
{
|
{
|
||||||
big_enough = true;
|
big_enough = true;
|
||||||
break;
|
break;
|
||||||
|
@ -15,12 +15,12 @@ showReleaseNotesUrl: true
|
|||||||
# that are checked. They may not match with the actual requirements
|
# that are checked. They may not match with the actual requirements
|
||||||
# imposed by other modules in the system.
|
# imposed by other modules in the system.
|
||||||
requirements:
|
requirements:
|
||||||
# Amount of available disk, in GB. Floating-point is allowed here.
|
# Amount of available disk, in GiB. Floating-point is allowed here.
|
||||||
# Note that this does not account for *usable* disk, so it is possible
|
# Note that this does not account for *usable* disk, so it is possible
|
||||||
# to pass this requirement, yet have no space to install to.
|
# to pass this requirement, yet have no space to install to.
|
||||||
requiredStorage: 5.5
|
requiredStorage: 5.5
|
||||||
|
|
||||||
# Amount of available RAM, in GB. Floating-point is allowed here.
|
# Amount of available RAM, in GiB. Floating-point is allowed here.
|
||||||
requiredRam: 1.0
|
requiredRam: 1.0
|
||||||
|
|
||||||
# To check for internet connectivity, Calamares does a HTTP GET
|
# To check for internet connectivity, Calamares does a HTTP GET
|
||||||
|
Loading…
Reference in New Issue
Block a user