[merge] with upstream
This commit is contained in:
commit
7a93a3a430
1
CHANGES
1
CHANGES
@ -7,6 +7,7 @@ website will have to do for older versions.
|
|||||||
|
|
||||||
This release contains contributions from (alphabetically by first name):
|
This release contains contributions from (alphabetically by first name):
|
||||||
- Alf Gaida
|
- Alf Gaida
|
||||||
|
- aliveafter1000
|
||||||
- Caio Carvalho
|
- Caio Carvalho
|
||||||
- Kevin Kofler
|
- Kevin Kofler
|
||||||
- Philip Mueller
|
- Philip Mueller
|
||||||
|
@ -89,7 +89,7 @@ Partition* createNewPartition( PartitionNode* parent,
|
|||||||
FileSystem::Type fsType,
|
FileSystem::Type fsType,
|
||||||
qint64 firstSector,
|
qint64 firstSector,
|
||||||
qint64 lastSector,
|
qint64 lastSector,
|
||||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
PartitionTable::Flags flags );
|
||||||
|
|
||||||
Partition* createNewEncryptedPartition( PartitionNode* parent,
|
Partition* createNewEncryptedPartition( PartitionNode* parent,
|
||||||
const Device& device,
|
const Device& device,
|
||||||
@ -98,7 +98,7 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
|
|||||||
qint64 firstSector,
|
qint64 firstSector,
|
||||||
qint64 lastSector,
|
qint64 lastSector,
|
||||||
const QString& passphrase,
|
const QString& passphrase,
|
||||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
PartitionTable::Flags flags );
|
||||||
|
|
||||||
Partition* clonePartition( Device* device, Partition* partition );
|
Partition* clonePartition( Device* device, Partition* partition );
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2018, Philip Müller <philm@manjaro.org>
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -32,6 +31,7 @@
|
|||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
|
|
||||||
|
#include <utils/CalamaresUtilsSystem.h>
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
#include <JobQueue.h>
|
#include <JobQueue.h>
|
||||||
#include <GlobalStorage.h>
|
#include <GlobalStorage.h>
|
||||||
@ -162,10 +162,26 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
static FstabEntryList
|
static FstabEntryList
|
||||||
lookForFstabEntries( const QString& partitionPath )
|
lookForFstabEntries( const QString& partitionPath )
|
||||||
{
|
{
|
||||||
|
QStringList mountOptions{ "ro" };
|
||||||
|
|
||||||
|
auto r = CalamaresUtils::System::runCommand(
|
||||||
|
CalamaresUtils::System::RunLocation::RunInHost,
|
||||||
|
{ "blkid", "-s", "TYPE", "-o", "value", partitionPath }
|
||||||
|
);
|
||||||
|
if ( r.getExitCode() )
|
||||||
|
cWarning() << "blkid on" << partitionPath << "failed.";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString fstype = r.getOutput().trimmed();
|
||||||
|
if ( ( fstype == "ext3" ) || ( fstype == "ext4" ) )
|
||||||
|
mountOptions.append( "noload" );
|
||||||
|
}
|
||||||
|
|
||||||
FstabEntryList fstabEntries;
|
FstabEntryList fstabEntries;
|
||||||
QTemporaryDir mountsDir;
|
QTemporaryDir mountsDir;
|
||||||
|
mountsDir.setAutoRemove( false );
|
||||||
|
|
||||||
int exit = QProcess::execute( "mount", { "-o", "ro,noload", partitionPath, mountsDir.path() } );
|
int exit = QProcess::execute( "mount", { "-o", mountOptions.join(','), partitionPath, mountsDir.path() } );
|
||||||
if ( !exit ) // if all is well
|
if ( !exit ) // if all is well
|
||||||
{
|
{
|
||||||
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
|
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
|
||||||
@ -181,11 +197,7 @@ lookForFstabEntries( const QString& partitionPath )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( QProcess::execute( "umount", { "-R", mountsDir.path() } ) )
|
if ( QProcess::execute( "umount", { "-R", mountsDir.path() } ) )
|
||||||
{
|
|
||||||
cWarning() << "Could not unmount" << mountsDir.path();
|
cWarning() << "Could not unmount" << mountsDir.path();
|
||||||
// There is stuff left in there, really don't remove
|
|
||||||
mountsDir.setAutoRemove( false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fstabEntries;
|
return fstabEntries;
|
||||||
@ -285,7 +297,6 @@ runOsprober( PartitionCoreModule* core )
|
|||||||
osprober.readAllStandardOutput() ).trimmed() );
|
osprober.readAllStandardOutput() ).trimmed() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString osProberReport( "Osprober lines, clean:\n" );
|
|
||||||
QStringList osproberCleanLines;
|
QStringList osproberCleanLines;
|
||||||
OsproberEntryList osproberEntries;
|
OsproberEntryList osproberEntries;
|
||||||
const auto lines = osproberOutput.split( '\n' );
|
const auto lines = osproberOutput.split( '\n' );
|
||||||
@ -317,8 +328,11 @@ runOsprober( PartitionCoreModule* core )
|
|||||||
osproberCleanLines.append( line );
|
osproberCleanLines.append( line );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
osProberReport.append( osproberCleanLines.join( '\n' ) );
|
|
||||||
cDebug() << osProberReport;
|
if ( osproberCleanLines.count() > 0 )
|
||||||
|
cDebug() << "os-prober lines after cleanup:" << Logger::DebugList( osproberCleanLines );
|
||||||
|
else
|
||||||
|
cDebug() << "os-prober gave no output.";
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
firstFreeSector,
|
firstFreeSector,
|
||||||
lastSectorForRoot
|
lastSectorForRoot,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -216,20 +217,17 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
firstFreeSector,
|
firstFreeSector,
|
||||||
lastSectorForRoot,
|
lastSectorForRoot,
|
||||||
luksPassphrase
|
luksPassphrase,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setFormat( rootPartition, true );
|
PartitionInfo::setFormat( rootPartition, true );
|
||||||
PartitionInfo::setMountPoint( rootPartition, "/" );
|
PartitionInfo::setMountPoint( rootPartition, "/" );
|
||||||
if( isEfi )
|
// Some buggy (legacy) BIOSes test if the bootflag of at least one partition is set.
|
||||||
{
|
// Otherwise they ignore the device in boot-order, so add it here.
|
||||||
core->createPartition( dev, rootPartition );
|
core->createPartition( dev, rootPartition,
|
||||||
}
|
rootPartition->activeFlags() | ( isEfi ? PartitionTable::FlagNone : PartitionTable::FlagBoot )
|
||||||
else
|
);
|
||||||
{
|
|
||||||
// Set FlagBoot for some legacy BIOSes, otherwise may not boot.
|
|
||||||
core->createPartition( dev, rootPartition, PartitionTable::FlagBoot );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( shouldCreateSwap )
|
if ( shouldCreateSwap )
|
||||||
{
|
{
|
||||||
@ -242,7 +240,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1
|
dev->totalLogical() - 1,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -254,7 +253,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1,
|
dev->totalLogical() - 1,
|
||||||
luksPassphrase
|
luksPassphrase,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setFormat( swapPartition, true );
|
PartitionInfo::setFormat( swapPartition, true );
|
||||||
@ -304,7 +304,8 @@ doReplacePartition( PartitionCoreModule* core,
|
|||||||
newRoles,
|
newRoles,
|
||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
partition->firstSector(),
|
partition->firstSector(),
|
||||||
partition->lastSector()
|
partition->lastSector(),
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -316,7 +317,8 @@ doReplacePartition( PartitionCoreModule* core,
|
|||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
partition->firstSector(),
|
partition->firstSector(),
|
||||||
partition->lastSector(),
|
partition->lastSector(),
|
||||||
luksPassphrase
|
luksPassphrase,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
|
@ -128,6 +128,12 @@ public:
|
|||||||
|
|
||||||
void createPartitionTable( Device* device, PartitionTable::TableType type );
|
void createPartitionTable( Device* device, PartitionTable::TableType type );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a job to do the actual partition-creation.
|
||||||
|
*
|
||||||
|
* If @p flags is not FlagNone, then the given flags are
|
||||||
|
* applied to the newly-created partition.
|
||||||
|
*/
|
||||||
void createPartition( Device* device, Partition* partition,
|
void createPartition( Device* device, Partition* partition,
|
||||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||||
|
|
||||||
|
@ -635,7 +635,8 @@ ChoicePage::doAlongsideApply()
|
|||||||
candidate->roles(),
|
candidate->roles(),
|
||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
newLastSector + 2, // *
|
newLastSector + 2, // *
|
||||||
oldLastSector
|
oldLastSector,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -647,7 +648,8 @@ ChoicePage::doAlongsideApply()
|
|||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
newLastSector + 2, // *
|
newLastSector + 2, // *
|
||||||
oldLastSector,
|
oldLastSector,
|
||||||
luksPassphrase
|
luksPassphrase,
|
||||||
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
@ -735,7 +737,9 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
selectedPartition->firstSector(),
|
selectedPartition->firstSector(),
|
||||||
selectedPartition->lastSector(),
|
selectedPartition->lastSector(),
|
||||||
m_encryptWidget->passphrase() );
|
m_encryptWidget->passphrase(),
|
||||||
|
PartitionTable::FlagNone
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -745,7 +749,9 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
newRoles,
|
newRoles,
|
||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
selectedPartition->firstSector(),
|
selectedPartition->firstSector(),
|
||||||
selectedPartition->lastSector() );
|
selectedPartition->lastSector(),
|
||||||
|
PartitionTable::FlagNone
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
|
@ -359,7 +359,15 @@ PartitionJobTests::testResizePartition()
|
|||||||
|
|
||||||
Partition* freePartition = firstFreePartition( m_device->partitionTable() );
|
Partition* freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
Partition* partition = KPMHelpers::createNewPartition( freePartition->parent(), *m_device, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, oldFirst, oldLast );
|
Partition* partition = KPMHelpers::createNewPartition(
|
||||||
|
freePartition->parent(),
|
||||||
|
*m_device,
|
||||||
|
PartitionRole( PartitionRole::Primary ),
|
||||||
|
FileSystem::Ext4,
|
||||||
|
oldFirst,
|
||||||
|
oldLast,
|
||||||
|
PartitionTable::FlagNone
|
||||||
|
);
|
||||||
CreatePartitionJob* job = new CreatePartitionJob( m_device.data(), partition );
|
CreatePartitionJob* job = new CreatePartitionJob( m_device.data(), partition );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user