[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):
|
||||
- Alf Gaida
|
||||
- aliveafter1000
|
||||
- Caio Carvalho
|
||||
- Kevin Kofler
|
||||
- Philip Mueller
|
||||
|
@ -89,7 +89,7 @@ Partition* createNewPartition( PartitionNode* parent,
|
||||
FileSystem::Type fsType,
|
||||
qint64 firstSector,
|
||||
qint64 lastSector,
|
||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||
PartitionTable::Flags flags );
|
||||
|
||||
Partition* createNewEncryptedPartition( PartitionNode* parent,
|
||||
const Device& device,
|
||||
@ -98,7 +98,7 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
|
||||
qint64 firstSector,
|
||||
qint64 lastSector,
|
||||
const QString& passphrase,
|
||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||
PartitionTable::Flags flags );
|
||||
|
||||
Partition* clonePartition( Device* device, Partition* partition );
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright 2015-2016, Teo Mrnjavac <teo@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
|
||||
* 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/partition.h>
|
||||
|
||||
#include <utils/CalamaresUtilsSystem.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <JobQueue.h>
|
||||
#include <GlobalStorage.h>
|
||||
@ -162,10 +162,26 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||
static FstabEntryList
|
||||
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;
|
||||
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
|
||||
{
|
||||
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
|
||||
@ -181,11 +197,7 @@ lookForFstabEntries( const QString& partitionPath )
|
||||
}
|
||||
|
||||
if ( QProcess::execute( "umount", { "-R", mountsDir.path() } ) )
|
||||
{
|
||||
cWarning() << "Could not unmount" << mountsDir.path();
|
||||
// There is stuff left in there, really don't remove
|
||||
mountsDir.setAutoRemove( false );
|
||||
}
|
||||
}
|
||||
|
||||
return fstabEntries;
|
||||
@ -285,7 +297,6 @@ runOsprober( PartitionCoreModule* core )
|
||||
osprober.readAllStandardOutput() ).trimmed() );
|
||||
}
|
||||
|
||||
QString osProberReport( "Osprober lines, clean:\n" );
|
||||
QStringList osproberCleanLines;
|
||||
OsproberEntryList osproberEntries;
|
||||
const auto lines = osproberOutput.split( '\n' );
|
||||
@ -317,8 +328,11 @@ runOsprober( PartitionCoreModule* core )
|
||||
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 );
|
||||
|
||||
|
@ -204,7 +204,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::typeForName( defaultFsType ),
|
||||
firstFreeSector,
|
||||
lastSectorForRoot
|
||||
lastSectorForRoot,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -216,20 +217,17 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
||||
FileSystem::typeForName( defaultFsType ),
|
||||
firstFreeSector,
|
||||
lastSectorForRoot,
|
||||
luksPassphrase
|
||||
luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( rootPartition, true );
|
||||
PartitionInfo::setMountPoint( rootPartition, "/" );
|
||||
if( isEfi )
|
||||
{
|
||||
core->createPartition( dev, rootPartition );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set FlagBoot for some legacy BIOSes, otherwise may not boot.
|
||||
core->createPartition( dev, rootPartition, PartitionTable::FlagBoot );
|
||||
}
|
||||
// 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,
|
||||
rootPartition->activeFlags() | ( isEfi ? PartitionTable::FlagNone : PartitionTable::FlagBoot )
|
||||
);
|
||||
|
||||
if ( shouldCreateSwap )
|
||||
{
|
||||
@ -242,7 +240,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalLogical() - 1
|
||||
dev->totalLogical() - 1,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -254,7 +253,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalLogical() - 1,
|
||||
luksPassphrase
|
||||
luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( swapPartition, true );
|
||||
@ -304,7 +304,8 @@ doReplacePartition( PartitionCoreModule* core,
|
||||
newRoles,
|
||||
FileSystem::typeForName( defaultFsType ),
|
||||
partition->firstSector(),
|
||||
partition->lastSector()
|
||||
partition->lastSector(),
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -316,7 +317,8 @@ doReplacePartition( PartitionCoreModule* core,
|
||||
FileSystem::typeForName( defaultFsType ),
|
||||
partition->firstSector(),
|
||||
partition->lastSector(),
|
||||
luksPassphrase
|
||||
luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
|
@ -128,6 +128,12 @@ public:
|
||||
|
||||
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,
|
||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||
|
||||
|
@ -635,7 +635,8 @@ ChoicePage::doAlongsideApply()
|
||||
candidate->roles(),
|
||||
FileSystem::typeForName( m_defaultFsType ),
|
||||
newLastSector + 2, // *
|
||||
oldLastSector
|
||||
oldLastSector,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -647,7 +648,8 @@ ChoicePage::doAlongsideApply()
|
||||
FileSystem::typeForName( m_defaultFsType ),
|
||||
newLastSector + 2, // *
|
||||
oldLastSector,
|
||||
luksPassphrase
|
||||
luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
@ -735,7 +737,9 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
||||
FileSystem::typeForName( m_defaultFsType ),
|
||||
selectedPartition->firstSector(),
|
||||
selectedPartition->lastSector(),
|
||||
m_encryptWidget->passphrase() );
|
||||
m_encryptWidget->passphrase(),
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,7 +749,9 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
||||
newRoles,
|
||||
FileSystem::typeForName( m_defaultFsType ),
|
||||
selectedPartition->firstSector(),
|
||||
selectedPartition->lastSector() );
|
||||
selectedPartition->lastSector(),
|
||||
PartitionTable::FlagNone
|
||||
);
|
||||
}
|
||||
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
|
@ -359,7 +359,15 @@ PartitionJobTests::testResizePartition()
|
||||
|
||||
Partition* freePartition = firstFreePartition( m_device->partitionTable() );
|
||||
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 );
|
||||
job->updatePreview();
|
||||
m_queue.enqueue( job_ptr( job ) );
|
||||
|
Loading…
Reference in New Issue
Block a user