Compare commits
8 Commits
issue-2225
...
v1.1.4.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2f2a55a359 | ||
![]() |
07b6b1265b | ||
![]() |
973f6935e4 | ||
![]() |
825f657bc6 | ||
![]() |
70ddfa25dd | ||
![]() |
eabe0c68d6 | ||
![]() |
2ac1b29401 | ||
![]() |
34e686decb |
@@ -94,7 +94,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast ca cs_CZ da de en en_GB es_MX es fi_
|
|||||||
|
|
||||||
set( CALAMARES_VERSION_MAJOR 1 )
|
set( CALAMARES_VERSION_MAJOR 1 )
|
||||||
set( CALAMARES_VERSION_MINOR 1 )
|
set( CALAMARES_VERSION_MINOR 1 )
|
||||||
set( CALAMARES_VERSION_PATCH 3 )
|
set( CALAMARES_VERSION_PATCH 4 )
|
||||||
set( CALAMARES_VERSION_RC 0 )
|
set( CALAMARES_VERSION_RC 0 )
|
||||||
|
|
||||||
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
||||||
|
@@ -125,9 +125,44 @@ AlongsidePage::init( PartitionCoreModule* core , const OsproberEntryList& osprob
|
|||||||
string( Calamares::Branding::ProductName ) ) );
|
string( Calamares::Branding::ProductName ) ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// TODO 2.0: move this to a Utils namespace.
|
||||||
|
// Iterate over devices in devicemodel, foreach device, if it's DOS MBR and limit is
|
||||||
|
// reached and we have an osprober entry inside it, then disable alongside.
|
||||||
|
QStringList pathsOfDevicesWithPrimariesLimitReached;
|
||||||
|
for ( int row = 0; row < m_core->deviceModel()->rowCount(); ++row )
|
||||||
|
{
|
||||||
|
const QModelIndex& deviceIndex = m_core->deviceModel()->index( row );
|
||||||
|
|
||||||
|
Device* dev = m_core->deviceModel()->deviceForIndex( deviceIndex );
|
||||||
|
if ( dev->partitionTable() &&
|
||||||
|
( dev->partitionTable()->type() == PartitionTable::msdos ||
|
||||||
|
dev->partitionTable()->type() == PartitionTable::msdos_sectorbased ) &&
|
||||||
|
dev->partitionTable()->numPrimaries() == dev->partitionTable()->maxPrimaries() )
|
||||||
|
{
|
||||||
|
// Primaries limit reached!
|
||||||
|
pathsOfDevicesWithPrimariesLimitReached.append( dev->deviceNode() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End MBR primary limit check.
|
||||||
|
|
||||||
|
cDebug() << "Devices with limit reached:" << pathsOfDevicesWithPrimariesLimitReached;
|
||||||
|
cDebug() << "Osprober entries:";
|
||||||
foreach ( const OsproberEntry& e, osproberEntries )
|
foreach ( const OsproberEntry& e, osproberEntries )
|
||||||
{
|
{
|
||||||
if ( e.canBeResized )
|
cDebug() << " *" << e.path << e.line;
|
||||||
|
// TODO 2.0: move this to a Utils namespace.
|
||||||
|
bool cantCreatePartitions = false;
|
||||||
|
foreach ( const QString& devicePath, pathsOfDevicesWithPrimariesLimitReached )
|
||||||
|
{
|
||||||
|
if ( e.path.startsWith( devicePath ) )
|
||||||
|
{
|
||||||
|
cantCreatePartitions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End partition creatable check.
|
||||||
|
|
||||||
|
if ( e.canBeResized && !cantCreatePartitions )
|
||||||
m_partitionsComboBox->addItem( e.prettyName + " (" + e.path + ")", e.path );
|
m_partitionsComboBox->addItem( e.prettyName + " (" + e.path + ")", e.path );
|
||||||
}
|
}
|
||||||
setNextEnabled( true );
|
setNextEnabled( true );
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include "core/DeviceModel.h"
|
#include "core/DeviceModel.h"
|
||||||
#include "core/PartitionModel.h"
|
#include "core/PartitionModel.h"
|
||||||
#include "OsproberEntry.h"
|
#include "OsproberEntry.h"
|
||||||
|
#include "core/partitiontable.h"
|
||||||
|
#include "core/device.h"
|
||||||
|
|
||||||
#include "PrettyRadioButton.h"
|
#include "PrettyRadioButton.h"
|
||||||
|
|
||||||
@@ -111,6 +113,26 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
|||||||
m_itemsLayout->addWidget( eraseButton );
|
m_itemsLayout->addWidget( eraseButton );
|
||||||
m_itemsLayout->setSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
m_itemsLayout->setSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
||||||
|
|
||||||
|
// TODO 2.0: move this to a Utils namespace.
|
||||||
|
// Iterate over devices in devicemodel, foreach device, if it's DOS MBR and limit is
|
||||||
|
// reached and we have an osprober entry inside it, then disable alongside.
|
||||||
|
QStringList pathsOfDevicesWithPrimariesLimitReached;
|
||||||
|
for ( int row = 0; row < m_core->deviceModel()->rowCount(); ++row )
|
||||||
|
{
|
||||||
|
const QModelIndex& deviceIndex = m_core->deviceModel()->index( row );
|
||||||
|
|
||||||
|
Device* dev = m_core->deviceModel()->deviceForIndex( deviceIndex );
|
||||||
|
if ( dev->partitionTable() &&
|
||||||
|
( dev->partitionTable()->type() == PartitionTable::msdos ||
|
||||||
|
dev->partitionTable()->type() == PartitionTable::msdos_sectorbased ) &&
|
||||||
|
dev->partitionTable()->numPrimaries() == dev->partitionTable()->maxPrimaries() )
|
||||||
|
{
|
||||||
|
// Primaries limit reached!
|
||||||
|
pathsOfDevicesWithPrimariesLimitReached.append( dev->deviceNode() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cDebug() << "Devices with limit reached:" << pathsOfDevicesWithPrimariesLimitReached;
|
||||||
|
|
||||||
if ( osproberEntries.count() == 0 )
|
if ( osproberEntries.count() == 0 )
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
@@ -137,6 +159,18 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
|||||||
{
|
{
|
||||||
QString osName = osproberEntries.first().prettyName;
|
QString osName = osproberEntries.first().prettyName;
|
||||||
|
|
||||||
|
// Find out if our osprober entry (which is the shrink candidate) is on a
|
||||||
|
// device that can accommodate more partitions.
|
||||||
|
bool cantCreatePartitions = false;
|
||||||
|
foreach ( const QString& devicePath, pathsOfDevicesWithPrimariesLimitReached )
|
||||||
|
{
|
||||||
|
if ( osproberEntries.first().path.startsWith( devicePath ) )
|
||||||
|
{
|
||||||
|
cantCreatePartitions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !osName.isEmpty() )
|
if ( !osName.isEmpty() )
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
@@ -207,6 +241,8 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
|||||||
}
|
}
|
||||||
if ( !osproberEntries.first().canBeResized )
|
if ( !osproberEntries.first().canBeResized )
|
||||||
alongsideButton->hide();
|
alongsideButton->hide();
|
||||||
|
if ( cantCreatePartitions )
|
||||||
|
alongsideButton->hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -223,6 +259,27 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find out if at least one of our osprober entries is on a
|
||||||
|
// device that can accommodate more partitions.
|
||||||
|
bool atLeastOneCanCreatePartitions = false;
|
||||||
|
foreach ( const OsproberEntry& entry, osproberEntries )
|
||||||
|
{
|
||||||
|
bool cantCreatePartitions = false;
|
||||||
|
foreach ( const QString& devicePath, pathsOfDevicesWithPrimariesLimitReached )
|
||||||
|
{
|
||||||
|
if ( entry.path.startsWith( devicePath ) )
|
||||||
|
{
|
||||||
|
cantCreatePartitions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( entry.canBeResized && !cantCreatePartitions )
|
||||||
|
{
|
||||||
|
atLeastOneCanCreatePartitions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
|
m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
|
||||||
"What would you like to do?" ) );
|
"What would you like to do?" ) );
|
||||||
@@ -254,7 +311,7 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
|||||||
string( Calamares::Branding::ShortVersionedName ) ) );
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( !atLeastOneCanBeResized )
|
if ( !( atLeastOneCanBeResized && atLeastOneCanCreatePartitions ) )
|
||||||
alongsideButton->hide();
|
alongsideButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -458,7 +458,6 @@ PartitionViewStep::jobs() const
|
|||||||
bool
|
bool
|
||||||
PartitionViewStep::canBeResized( const QString& partitionPath )
|
PartitionViewStep::canBeResized( const QString& partitionPath )
|
||||||
{
|
{
|
||||||
//FIXME: check for max partitions count on DOS MBR
|
|
||||||
cDebug() << "checking if" << partitionPath << "can be resized.";
|
cDebug() << "checking if" << partitionPath << "can be resized.";
|
||||||
QString partitionWithOs = partitionPath;
|
QString partitionWithOs = partitionPath;
|
||||||
if ( partitionWithOs.startsWith( "/dev/" ) )
|
if ( partitionWithOs.startsWith( "/dev/" ) )
|
||||||
|
@@ -198,10 +198,17 @@ QString
|
|||||||
ClearMountsJob::tryClearSwap( const QString& partPath )
|
ClearMountsJob::tryClearSwap( const QString& partPath )
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start( "mkswap", { partPath } );
|
process.start( "blkid", { "-s", "UUID", "-o", "value", partPath } );
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
if ( process.exitCode() == 0 )
|
QString swapPartUuid = QString::fromLocal8Bit( process.readAllStandardOutput() ).simplified();
|
||||||
return QString( "Successfully cleared swap %1." ).arg( partPath );
|
if ( process.exitCode() != 0 ||
|
||||||
|
swapPartUuid.isEmpty() )
|
||||||
|
return QString();
|
||||||
|
|
||||||
return QString();
|
process.start( "mkswap", { "-U", swapPartUuid, partPath } );
|
||||||
|
process.waitForFinished();
|
||||||
|
if ( process.exitCode() != 0 )
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
return QString( "Successfully cleared swap %1." ).arg( partPath );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user