Merge pull request #1 from manjaro/development

merge manjaro-dev
This commit is contained in:
Bernhard Landauer 2017-01-20 07:31:15 +01:00 committed by GitHub
commit 6bfa27ec00
48 changed files with 310 additions and 111 deletions

View File

@ -6,7 +6,7 @@ function( calamares_add_plugin )
set( NAME ${ARGV0} ) set( NAME ${ARGV0} )
set( options NO_INSTALL SHARED_LIB ) set( options NO_INSTALL SHARED_LIB )
set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES ) set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
set( multiValueArgs SOURCES UI LINK_LIBRARIES COMPILE_DEFINITIONS ) set( multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS )
cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set( PLUGIN_NAME ${NAME} ) set( PLUGIN_NAME ${NAME} )
set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME} ) set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME} )
@ -22,6 +22,7 @@ function( calamares_add_plugin )
if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" ) if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" ) message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" )
message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" ) message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" )
message( " ${Green}LINK_PRIVATE_LIBRARIES:${ColorReset} ${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
# message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" ) # message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" )
# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" ) # message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" )
# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" ) # message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" )
@ -60,6 +61,10 @@ function( calamares_add_plugin )
list( APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}" ) list( APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}" )
endif() endif()
if( PLUGIN_LINK_PRIVATE_LIBRARIES )
list( APPEND calamares_add_library_args "LINK_PRIVATE_LIBRARIES" "${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
endif()
if( PLUGIN_COMPILE_DEFINITIONS ) if( PLUGIN_COMPILE_DEFINITIONS )
list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} ) list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} )
endif() endif()

View File

@ -27,7 +27,7 @@ Modules:
* partition: * partition:
* extra-cmake-modules * extra-cmake-modules
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService * KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
* KPMcore >= 2.2 * KPMcore >= 3.0
* bootloader: * bootloader:
* systemd-boot or GRUB * systemd-boot or GRUB
* unpackfs: * unpackfs:

View File

@ -4,10 +4,10 @@ componentName: manjaro-kde
strings: strings:
productName: Manjaro Linux productName: Manjaro Linux
shortProductName: Manjaro shortProductName: Manjaro
version: 16.10 version: 17.0
shortVersion: 16.10 shortVersion: 17.0
versionedName: Manjaro Linux 16.10 "Fringilla" versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 16.10 shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro bootloaderEntryName: Manjaro
images: images:

View File

@ -4,10 +4,10 @@ componentName: manjaro-xfce
strings: strings:
productName: Manjaro Linux productName: Manjaro Linux
shortProductName: Manjaro shortProductName: Manjaro
version: 16.10 version: 17.0
shortVersion: 16.10 shortVersion: 17.0
versionedName: Manjaro Linux 16.10 "Fringilla" versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 16.10 shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro bootloaderEntryName: Manjaro
images: images:

View File

@ -4,10 +4,10 @@ componentName: manjaro
strings: strings:
productName: Manjaro Linux productName: Manjaro Linux
shortProductName: Manjaro shortProductName: Manjaro
version: 16.10 version: 17.0
shortVersion: 16.10 shortVersion: 17.0
versionedName: Manjaro Linux 16.10 "Fringilla" versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 16.10 shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro bootloaderEntryName: Manjaro
images: images:

View File

@ -59,12 +59,12 @@ endif()
qt5_use_modules( calamares_bin Core Widgets ) qt5_use_modules( calamares_bin Core Widgets )
target_link_libraries( calamares_bin target_link_libraries( calamares_bin
${CALAMARES_LIBRARIES} PRIVATE
calamaresui ${CALAMARES_LIBRARIES}
Qt5::Core calamaresui
Qt5::Widgets Qt5::Core
yaml-cpp Qt5::Widgets
${LINK_LIBRARIES} ${LINK_LIBRARIES}
) )
install( TARGETS calamares_bin install( TARGETS calamares_bin

View File

@ -62,10 +62,10 @@ calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES} SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI} UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
EXPORT_MACRO UIDLLEXPORT_PRO EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
yaml-cpp yaml-cpp
Qt5::Svg Qt5::Svg
Qt5::QuickWidgets Qt5::QuickWidgets
${OPTIONAL_PRIVATE_LIBRARIES} ${OPTIONAL_PRIVATE_LIBRARIES}
RESOURCES libcalamaresui.qrc RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends EXPORT CalamaresLibraryDepends

View File

@ -3,7 +3,7 @@ calamares_add_plugin( dracutlukscfg
EXPORT_MACRO PLUGINDLLEXPORT_PRO EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES SOURCES
DracutLuksCfgJob.cpp DracutLuksCfgJob.cpp
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamares calamares
SHARED_LIB SHARED_LIB
) )

View File

@ -3,7 +3,7 @@ calamares_add_plugin( dummycpp
EXPORT_MACRO PLUGINDLLEXPORT_PRO EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES SOURCES
DummyCppJob.cpp DummyCppJob.cpp
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamares calamares
SHARED_LIB SHARED_LIB
) )

View File

@ -7,7 +7,7 @@ calamares_add_plugin( finished
FinishedPage.cpp FinishedPage.cpp
UI UI
FinishedPage.ui FinishedPage.ui
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
SHARED_LIB SHARED_LIB
) )

View File

@ -19,7 +19,7 @@ calamares_add_plugin( interactiveterminal
SOURCES SOURCES
InteractiveTerminalViewStep.cpp InteractiveTerminalViewStep.cpp
InteractiveTerminalPage.cpp InteractiveTerminalPage.cpp
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
KF5::Service KF5::Service
KF5::Parts KF5::Parts

View File

@ -14,7 +14,7 @@ calamares_add_plugin( keyboard
KeyboardPage.ui KeyboardPage.ui
RESOURCES RESOURCES
keyboard.qrc keyboard.qrc
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
SHARED_LIB SHARED_LIB
) )

View File

@ -29,6 +29,7 @@ KeyboardViewStep::KeyboardViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( new KeyboardPage() ) , m_widget( new KeyboardPage() )
, m_nextEnabled( false ) , m_nextEnabled( false )
, m_writeEtcDefaultKeyboard( true )
{ {
m_widget->init(); m_widget->init();
m_nextEnabled = true; m_nextEnabled = true;

View File

@ -15,7 +15,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
LicensePage.cpp LicensePage.cpp
UI UI
LicensePage.ui LicensePage.ui
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
SHARED_LIB SHARED_LIB
) )

View File

@ -14,7 +14,9 @@ calamares_add_plugin( locale
UI UI
RESOURCES RESOURCES
locale.qrc locale.qrc
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB SHARED_LIB
) )

View File

@ -12,7 +12,9 @@ calamares_add_plugin( netinstall
widgets/groupselectionwidget.ui widgets/groupselectionwidget.ui
RESOURCES RESOURCES
netinstall.qrc netinstall.qrc
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB SHARED_LIB
) )

View File

@ -10,7 +10,7 @@ find_package( KF5 REQUIRED CoreAddons )
# These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service # These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service ) find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
find_package( KPMcore 2.2 REQUIRED ) find_package( KPMcore 3.0.0 REQUIRED )
add_subdirectory( tests ) add_subdirectory( tests )
@ -66,7 +66,7 @@ calamares_add_plugin( partition
gui/EncryptWidget.ui gui/EncryptWidget.ui
gui/PartitionPage.ui gui/PartitionPage.ui
gui/ReplaceWidget.ui gui/ReplaceWidget.ui
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
kpmcore kpmcore
calamaresui calamaresui
KF5::CoreAddons KF5::CoreAddons

View File

@ -151,6 +151,12 @@ createNewEncryptedPartition( PartitionNode* parent,
FileSystemFactory::create( FileSystem::Luks, FileSystemFactory::create( FileSystem::Luks,
firstSector, firstSector,
lastSector ) ); lastSector ) );
if ( !fs )
{
qDebug() << "ERROR: cannot create LUKS filesystem. Giving up.";
return nullptr;
}
fs->createInnerFileSystem( fsType ); fs->createInnerFileSystem( fsType );
fs->setPassphrase( passphrase ); fs->setPassphrase( passphrase );
Partition* p = new Partition( parent, Partition* p = new Partition( parent,

View File

@ -51,8 +51,9 @@ canBeReplaced( Partition* candidate )
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024; qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
cDebug() << "Required storage B:" << requiredStorageB cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB cDebug() << "Storage capacity B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
if ( ok && if ( ok &&
availableStorageB > requiredStorageB ) availableStorageB > requiredStorageB )
@ -102,7 +103,9 @@ canBeResized( Partition* candidate )
cDebug() << "Required storage B:" << requiredStorageB cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length()
<< " sectorsUsed:" << candidate->sectorsUsed() << " fsType:" << candidate->fileSystem().name();
if ( ok && if ( ok &&
availableStorageB > requiredStorageB ) availableStorageB > requiredStorageB )

View File

@ -128,11 +128,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
empty_space_size = 1; empty_space_size = 1;
} }
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1; qint64 firstFreeSector = empty_space_size MiB / dev->logicalSize() + 1;
if ( isEfi ) if ( isEfi )
{ {
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() ); qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
core->createPartitionTable( dev, PartitionTable::gpt ); core->createPartitionTable( dev, PartitionTable::gpt );
Partition* efiPartition = KPMHelpers::createNewPartition( Partition* efiPartition = KPMHelpers::createNewPartition(
dev->partitionTable(), dev->partitionTable(),
@ -157,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
} }
bool shouldCreateSwap = false; bool shouldCreateSwap = false;
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize(); qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB ); qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB = qint64 requiredSpaceB =
( Calamares::JobQueue::instance()-> ( Calamares::JobQueue::instance()->
@ -168,10 +168,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
// If there is enough room for ESP + root + swap, create swap, otherwise don't. // If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB; shouldCreateSwap = availableSpaceB > requiredSpaceB;
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap ) if ( shouldCreateSwap )
{ {
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1; lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1;
} }
Partition* rootPartition = nullptr; Partition* rootPartition = nullptr;
@ -213,7 +213,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ), PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap, FileSystem::LinuxSwap,
lastSectorForRoot + 1, lastSectorForRoot + 1,
dev->totalSectors() - 1 dev->totalLogical() - 1
); );
} }
else else
@ -224,7 +224,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ), PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap, FileSystem::LinuxSwap,
lastSectorForRoot + 1, lastSectorForRoot + 1,
dev->totalSectors() - 1, dev->totalLogical() - 1,
luksPassphrase luksPassphrase
); );
} }

View File

@ -97,6 +97,7 @@ isIso9660( const Device* device )
PartitionCoreModule::DeviceInfo::DeviceInfo( Device* _device ) PartitionCoreModule::DeviceInfo::DeviceInfo( Device* _device )
: device( _device ) : device( _device )
, partitionModel( new PartitionModel ) , partitionModel( new PartitionModel )
, immutableDevice( new Device( *_device ) )
{} {}
PartitionCoreModule::DeviceInfo::~DeviceInfo() PartitionCoreModule::DeviceInfo::~DeviceInfo()
@ -235,7 +236,7 @@ PartitionCoreModule::bootLoaderModel() const
} }
PartitionModel* PartitionModel*
PartitionCoreModule::partitionModelForDevice( Device* device ) const PartitionCoreModule::partitionModelForDevice( const Device* device ) const
{ {
DeviceInfo* info = infoForDevice( device ); DeviceInfo* info = infoForDevice( device );
Q_ASSERT( info ); Q_ASSERT( info );
@ -244,14 +245,14 @@ PartitionCoreModule::partitionModelForDevice( Device* device ) const
Device* Device*
PartitionCoreModule::createImmutableDeviceCopy( Device* device ) PartitionCoreModule::immutableDeviceCopy( const Device* device )
{ {
CoreBackend* backend = CoreBackendManager::self()->backend(); Q_ASSERT( device );
DeviceInfo* info = infoForDevice( device );
if ( !info )
return nullptr;
QString node = device->deviceNode(); return info->immutableDevice.data();
cDebug() << "Creating immutable copy for node:" << node;
Device* deviceBefore = backend->scanDevice( node );
return deviceBefore;
} }
@ -440,6 +441,7 @@ PartitionCoreModule::jobs() const
lst << info->jobs; lst << info->jobs;
devices << info->device.data(); devices << info->device.data();
} }
cDebug() << "Creating FillGlobalStorageJob with bootLoader path" << m_bootLoaderInstallPath;
lst << Calamares::job_ptr( new FillGlobalStorageJob( devices, m_bootLoaderInstallPath ) ); lst << Calamares::job_ptr( new FillGlobalStorageJob( devices, m_bootLoaderInstallPath ) );
@ -566,12 +568,15 @@ PartitionCoreModule::scanForEfiSystemPartitions()
} }
PartitionCoreModule::DeviceInfo* PartitionCoreModule::DeviceInfo*
PartitionCoreModule::infoForDevice( Device* device ) const PartitionCoreModule::infoForDevice( const Device* device ) const
{ {
for ( auto deviceInfo : m_deviceInfos ) for ( auto it = m_deviceInfos.constBegin();
it != m_deviceInfos.constEnd(); ++it )
{ {
if ( deviceInfo->device.data() == device ) if ( ( *it )->device.data() == device )
return deviceInfo; return *it;
if ( ( *it )->immutableDevice.data() == device )
return *it;
} }
return nullptr; return nullptr;
} }
@ -592,6 +597,7 @@ PartitionCoreModule::findPartitionByMountPoint( const QString& mountPoint ) cons
void void
PartitionCoreModule::setBootLoaderInstallPath( const QString& path ) PartitionCoreModule::setBootLoaderInstallPath( const QString& path )
{ {
cDebug() << "PCM::setBootLoaderInstallPath" << path;
m_bootLoaderInstallPath = path; m_bootLoaderInstallPath = path;
} }
@ -681,7 +687,6 @@ QList< PartitionCoreModule::SummaryInfo >
PartitionCoreModule::createSummaryInfo() const PartitionCoreModule::createSummaryInfo() const
{ {
QList< SummaryInfo > lst; QList< SummaryInfo > lst;
CoreBackend* backend = CoreBackendManager::self()->backend();
for ( auto deviceInfo : m_deviceInfos ) for ( auto deviceInfo : m_deviceInfos )
{ {
if ( !deviceInfo->isDirty() ) if ( !deviceInfo->isDirty() )
@ -690,7 +695,7 @@ PartitionCoreModule::createSummaryInfo() const
summaryInfo.deviceName = deviceInfo->device->name(); summaryInfo.deviceName = deviceInfo->device->name();
summaryInfo.deviceNode = deviceInfo->device->deviceNode(); summaryInfo.deviceNode = deviceInfo->device->deviceNode();
Device* deviceBefore = backend->scanDevice( deviceInfo->device->deviceNode() ); Device* deviceBefore = deviceInfo->immutableDevice.data();
summaryInfo.partitionModelBefore = new PartitionModel; summaryInfo.partitionModelBefore = new PartitionModel;
summaryInfo.partitionModelBefore->init( deviceBefore, m_osproberLines ); summaryInfo.partitionModelBefore->init( deviceBefore, m_osproberLines );
// Make deviceBefore a child of partitionModelBefore so that it is not // Make deviceBefore a child of partitionModelBefore so that it is not

View File

@ -68,7 +68,7 @@ public:
DeviceModel* deviceModel() const; DeviceModel* deviceModel() const;
PartitionModel* partitionModelForDevice( Device* device ) const; PartitionModel* partitionModelForDevice( const Device* device ) const;
//HACK: all devices change over time, and together make up the state of the CoreModule. //HACK: all devices change over time, and together make up the state of the CoreModule.
// However this makes it hard to show the *original* state of a device. // However this makes it hard to show the *original* state of a device.
@ -77,7 +77,7 @@ public:
// This should probably be redone some other way. // This should probably be redone some other way.
// -- Teo 4/2015 // -- Teo 4/2015
//FIXME: make this horrible method private. -- Teo 12/2015 //FIXME: make this horrible method private. -- Teo 12/2015
static Device* createImmutableDeviceCopy( Device* device ); Device* immutableDeviceCopy( const Device* device );
QAbstractItemModel* bootLoaderModel() const; QAbstractItemModel* bootLoaderModel() const;
@ -147,6 +147,7 @@ private:
~DeviceInfo(); ~DeviceInfo();
QScopedPointer< Device > device; QScopedPointer< Device > device;
QScopedPointer< PartitionModel > partitionModel; QScopedPointer< PartitionModel > partitionModel;
const QScopedPointer< Device > immutableDevice;
QList< Calamares::job_ptr > jobs; QList< Calamares::job_ptr > jobs;
void forgetChanges(); void forgetChanges();
@ -166,7 +167,7 @@ private:
void updateIsDirty(); void updateIsDirty();
void scanForEfiSystemPartitions(); void scanForEfiSystemPartitions();
DeviceInfo* infoForDevice( Device* ) const; DeviceInfo* infoForDevice( const Device* ) const;
OsproberEntryList m_osproberLines; OsproberEntryList m_osproberLines;

View File

@ -83,6 +83,7 @@ PartitionIterator::operator!=( const PartitionIterator& other ) const
PartitionIterator PartitionIterator
PartitionIterator::begin( Device* device ) PartitionIterator::begin( Device* device )
{ {
Q_ASSERT(device);
PartitionTable* table = device->partitionTable(); PartitionTable* table = device->partitionTable();
if ( !table ) if ( !table )
return PartitionIterator( nullptr ); return PartitionIterator( nullptr );

View File

@ -148,7 +148,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
return PartitionInfo::mountPoint( partition ); return PartitionInfo::mountPoint( partition );
if ( col == SizeColumn ) if ( col == SizeColumn )
{ {
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
return KFormat().formatByteSize( size ); return KFormat().formatByteSize( size );
} }
cDebug() << "Unknown column" << col; cDebug() << "Unknown column" << col;
@ -175,12 +175,12 @@ PartitionModel::data( const QModelIndex& index, int role ) const
} }
} }
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() ); QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
QString prettySize = KFormat().formatByteSize( size ); QString prettySize = KFormat().formatByteSize( size );
return QVariant(name + " " + prettyFileSystem + " " + prettySize); return QVariant(name + " " + prettyFileSystem + " " + prettySize);
} }
case SizeRole: case SizeRole:
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
case IsFreeSpaceRole: case IsFreeSpaceRole:
return KPMHelpers::isPartitionFreeSpace( partition ); return KPMHelpers::isPartitionFreeSpace( partition );

View File

@ -594,7 +594,7 @@ ChoicePage::doAlongsideApply()
qint64 oldLastSector = candidate->lastSector(); qint64 oldLastSector = candidate->lastSector();
qint64 newLastSector = firstSector + qint64 newLastSector = firstSector +
m_afterPartitionSplitterWidget->splitPartitionSize() / m_afterPartitionSplitterWidget->splitPartitionSize() /
dev->logicalSectorSize(); dev->logicalSize();
m_core->resizePartition( dev, candidate, firstSector, newLastSector ); m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = nullptr; Partition* newPartition = nullptr;
@ -817,7 +817,7 @@ ChoicePage::updateDeviceStatePreview()
m_beforePartitionLabelsView = new PartitionLabelsView( m_previewBeforeFrame ); m_beforePartitionLabelsView = new PartitionLabelsView( m_previewBeforeFrame );
m_beforePartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions ); m_beforePartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions );
Device* deviceBefore = m_core->createImmutableDeviceCopy( currentDevice ); Device* deviceBefore = m_core->immutableDeviceCopy( currentDevice );
PartitionModel* model = new PartitionModel( m_beforePartitionBarsView ); PartitionModel* model = new PartitionModel( m_beforePartitionBarsView );
model->init( deviceBefore, m_core->osproberEntries() ); model->init( deviceBefore, m_core->osproberEntries() );
@ -1106,7 +1106,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
// When the chosen bootloader device changes, we update the choice in the PCM // When the chosen bootloader device changes, we update the choice in the PCM
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ), connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
[this]( int newIndex ) this, [this]( int newIndex )
{ {
QComboBox* bcb = qobject_cast< QComboBox* >( sender() ); QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
if ( bcb ) if ( bcb )

View File

@ -40,8 +40,9 @@
// Qt // Qt
#include <QComboBox> #include <QComboBox>
#include <QDir> #include <QDir>
#include <QSet>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QPushButton>
#include <QSet>
static QSet< FileSystem::Type > s_unmountableFS( static QSet< FileSystem::Type > s_unmountableFS(
{ {
@ -52,12 +53,13 @@ static QSet< FileSystem::Type > s_unmountableFS(
FileSystem::Lvm2_PV FileSystem::Lvm2_PV
} ); } );
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, QWidget* parentWidget ) CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget )
: QDialog( parentWidget ) : QDialog( parentWidget )
, m_ui( new Ui_CreatePartitionDialog ) , m_ui( new Ui_CreatePartitionDialog )
, m_partitionSizeController( new PartitionSizeController( this ) ) , m_partitionSizeController( new PartitionSizeController( this ) )
, m_device( device ) , m_device( device )
, m_parent( parentPartition ) , m_parent( parentPartition )
, m_usedMountPoints( usedMountPoints )
{ {
m_ui->setupUi( this ); m_ui->setupUi( this );
m_ui->encryptWidget->setText( tr( "En&crypt" ) ); m_ui->encryptWidget->setText( tr( "En&crypt" ) );
@ -101,11 +103,15 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) ); connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) ); connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &CreatePartitionDialog::checkMountPointSelection );
// Select a default // Select a default
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex ); m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
updateMountPointUi(); updateMountPointUi();
setupFlagsList(); setupFlagsList();
// Checks the initial selection.
checkMountPointSelection();
} }
CreatePartitionDialog::~CreatePartitionDialog() CreatePartitionDialog::~CreatePartitionDialog()
@ -252,6 +258,20 @@ CreatePartitionDialog::updateMountPointUi()
m_ui->mountPointComboBox->setCurrentText( QString() ); m_ui->mountPointComboBox->setCurrentText( QString() );
} }
void
CreatePartitionDialog::checkMountPointSelection()
{
const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) {
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one.");
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}
void void
CreatePartitionDialog::initPartResizerWidget( Partition* partition ) CreatePartitionDialog::initPartResizerWidget( Partition* partition )
{ {

View File

@ -42,7 +42,7 @@ class CreatePartitionDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CreatePartitionDialog( Device* device, PartitionNode* parentPartition, QWidget* parentWidget = nullptr ); CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
~CreatePartitionDialog(); ~CreatePartitionDialog();
/** /**
@ -61,6 +61,7 @@ public:
private Q_SLOTS: private Q_SLOTS:
void updateMountPointUi(); void updateMountPointUi();
void checkMountPointSelection();
private: private:
void setupFlagsList(); void setupFlagsList();
@ -69,6 +70,7 @@ private:
Device* m_device; Device* m_device;
PartitionNode* m_parent; PartitionNode* m_parent;
PartitionRole m_role = PartitionRole( PartitionRole::None ); PartitionRole m_role = PartitionRole( PartitionRole::None );
QStringList m_usedMountPoints;
void initGptPartitionTypeUi(); void initGptPartitionTypeUi();
void initMbrPartitionTypeUi(); void initMbrPartitionTypeUi();

View File

@ -108,7 +108,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>12</height> <height>13</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -126,6 +126,9 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QComboBox" name="fsComboBox"/> <widget class="QComboBox" name="fsComboBox"/>
</item> </item>
<item row="4" column="1">
<widget class="EncryptWidget" name="encryptWidget" native="true"/>
</item>
<item row="5" column="1"> <item row="5" column="1">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -162,14 +165,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="7" column="1">
<widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Flags:</string> <string>Flags:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QListWidget" name="m_listFlags"> <widget class="QListWidget" name="m_listFlags">
<property name="alternatingRowColors"> <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
@ -182,7 +197,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="9" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -195,9 +210,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="1">
<widget class="EncryptWidget" name="encryptWidget" native="true"/>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -43,13 +43,15 @@
// Qt // Qt
#include <QComboBox> #include <QComboBox>
#include <QDir> #include <QDir>
#include <QPushButton>
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, QWidget* parentWidget ) EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
: QDialog( parentWidget ) : QDialog( parentWidget )
, m_ui( new Ui_EditExistingPartitionDialog ) , m_ui( new Ui_EditExistingPartitionDialog )
, m_device( device ) , m_device( device )
, m_partition( partition ) , m_partition( partition )
, m_partitionSizeController( new PartitionSizeController( this ) ) , m_partitionSizeController( new PartitionSizeController( this ) )
, m_usedMountPoints( usedMountPoints )
{ {
m_ui->setupUi( this ); m_ui->setupUi( this );
@ -65,6 +67,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) ); m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &EditExistingPartitionDialog::checkMountPointSelection );
replacePartResizerWidget(); replacePartResizerWidget();
@ -291,3 +294,17 @@ EditExistingPartitionDialog::updateMountPointPicker()
if ( !canMount ) if ( !canMount )
m_ui->mountPointComboBox->setCurrentText( QString() ); m_ui->mountPointComboBox->setCurrentText( QString() );
} }
void
EditExistingPartitionDialog::checkMountPointSelection()
{
const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) {
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one.");
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}

View File

@ -40,16 +40,20 @@ class EditExistingPartitionDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
EditExistingPartitionDialog( Device* device, Partition* partition, QWidget* parentWidget = nullptr ); EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
~EditExistingPartitionDialog(); ~EditExistingPartitionDialog();
void applyChanges( PartitionCoreModule* module ); void applyChanges( PartitionCoreModule* module );
private slots:
void checkMountPointSelection();
private: private:
QScopedPointer< Ui_EditExistingPartitionDialog > m_ui; QScopedPointer< Ui_EditExistingPartitionDialog > m_ui;
Device* m_device; Device* m_device;
Partition* m_partition; Partition* m_partition;
PartitionSizeController* m_partitionSizeController; PartitionSizeController* m_partitionSizeController;
QStringList m_usedMountPoints;
PartitionTable::Flags newFlags() const; PartitionTable::Flags newFlags() const;
void setupFlagsList(); void setupFlagsList();

View File

@ -139,14 +139,14 @@
<item row="5" column="1"> <item row="5" column="1">
<widget class="QComboBox" name="fileSystemComboBox"/> <widget class="QComboBox" name="fileSystemComboBox"/>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Flags:</string> <string>Flags:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QListWidget" name="m_listFlags"> <widget class="QListWidget" name="m_listFlags">
<property name="alternatingRowColors"> <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
@ -159,6 +159,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1">
<widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -47,7 +47,7 @@ QStringList
buildUnknownDisklabelTexts( Device* dev ) buildUnknownDisklabelTexts( Device* dev )
{ {
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ), QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) }; KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) };
return texts; return texts;
} }

View File

@ -23,6 +23,7 @@
#include "core/BootLoaderModel.h" #include "core/BootLoaderModel.h"
#include "core/DeviceModel.h" #include "core/DeviceModel.h"
#include "core/PartitionCoreModule.h" #include "core/PartitionCoreModule.h"
#include "core/PartitionInfo.h"
#include "core/PartitionModel.h" #include "core/PartitionModel.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "gui/CreatePartitionDialog.h" #include "gui/CreatePartitionDialog.h"
@ -176,7 +177,7 @@ PartitionPage::onCreateClicked()
Partition* partition = model->partitionForIndex( index ); Partition* partition = model->partitionForIndex( index );
Q_ASSERT( partition ); Q_ASSERT( partition );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition->parent(), this ); QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition->parent(), getCurrentUsedMountpoints(), this );
dlg->initFromFreeSpace( partition ); dlg->initFromFreeSpace( partition );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
{ {
@ -265,7 +266,10 @@ PartitionPage::onPartitionViewActivated()
void void
PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
{ {
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( device, partition->parent(), this ); QStringList mountPoints = getCurrentUsedMountpoints();
mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this );
dlg->initFromPartitionToCreate( partition ); dlg->initFromPartitionToCreate( partition );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
{ {
@ -279,7 +283,10 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
void void
PartitionPage::editExistingPartition( Device* device, Partition* partition ) PartitionPage::editExistingPartition( Device* device, Partition* partition )
{ {
QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, this ); QStringList mountPoints = getCurrentUsedMountpoints();
mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
dlg->applyChanges( m_core ); dlg->applyChanges( m_core );
delete dlg; delete dlg;
@ -291,6 +298,7 @@ PartitionPage::updateBootLoaderInstallPath()
QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole ); QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole );
if ( !var.isValid() ) if ( !var.isValid() )
return; return;
qDebug() << "PartitionPage::updateBootLoaderInstallPath" << var.toString();
m_core->setBootLoaderInstallPath( var.toString() ); m_core->setBootLoaderInstallPath( var.toString() );
} }
@ -375,3 +383,24 @@ PartitionPage::updateBootLoaderIndex()
m_ui->bootLoaderComboBox->setCurrentIndex( m_lastSelectedBootLoaderIndex ); m_ui->bootLoaderComboBox->setCurrentIndex( m_lastSelectedBootLoaderIndex );
} }
} }
QStringList
PartitionPage::getCurrentUsedMountpoints()
{
QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
if ( !index.isValid() )
return QStringList();
Device* device = m_core->deviceModel()->deviceForIndex( index );
QStringList mountPoints;
for (Partition* partition : device->partitionTable()->children()) {
const QString& mountPoint = PartitionInfo::mountPoint( partition );
if (!mountPoint.isEmpty()) {
mountPoints << mountPoint;
}
}
return mountPoints;
}

View File

@ -62,6 +62,8 @@ private:
void updateFromCurrentDevice(); void updateFromCurrentDevice();
void updateBootLoaderIndex(); void updateBootLoaderIndex();
QStringList getCurrentUsedMountpoints();
QMutex m_revertMutex; QMutex m_revertMutex;
int m_lastSelectedBootLoaderIndex; int m_lastSelectedBootLoaderIndex;
}; };

View File

@ -135,7 +135,7 @@ PartitionSizeController::updatePartResizerWidget()
return; return;
m_updating = true; m_updating = true;
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize(); qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize();
qint64 firstSector = m_partition->firstSector(); qint64 firstSector = m_partition->firstSector();
qint64 lastSector = firstSector + sectorSize - 1; qint64 lastSector = firstSector + sectorSize - 1;
@ -185,7 +185,7 @@ PartitionSizeController::doUpdateSpinBox()
{ {
if ( !m_spinBox ) if ( !m_spinBox )
return; return;
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024; qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
m_spinBox->setValue( mbSize ); m_spinBox->setValue( mbSize );
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Aurélien Gâteau <agateau@kde.org> * Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org> * Copyright 2015-2016, Teo Mrnjavac <teo@kde.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
@ -86,10 +86,13 @@ mapForPartition( Partition* partition, const QString& uuid )
map[ "device" ] = partition->partitionPath(); map[ "device" ] = partition->partitionPath();
map[ "mountPoint" ] = PartitionInfo::mountPoint( partition ); map[ "mountPoint" ] = PartitionInfo::mountPoint( partition );
map[ "fs" ] = partition->fileSystem().name(); map[ "fs" ] = partition->fileSystem().name();
if ( partition->fileSystem().type() == FileSystem::Luks &&
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
map[ "uuid" ] = uuid; map[ "uuid" ] = uuid;
cDebug() << partition->partitionPath() cDebug() << partition->partitionPath()
<< "mtpoint:" << PartitionInfo::mountPoint( partition ) << "mtpoint:" << PartitionInfo::mountPoint( partition )
<< "fs:" << partition->fileSystem().name() << "fs:" << map[ "fs" ]
<< uuid; << uuid;
if ( partition->roles().has( PartitionRole::Luks ) ) if ( partition->roles().has( PartitionRole::Luks ) )
@ -98,7 +101,7 @@ mapForPartition( Partition* partition, const QString& uuid )
const FS::luks* luksFs = dynamic_cast< const FS::luks* >( &fsRef ); const FS::luks* luksFs = dynamic_cast< const FS::luks* >( &fsRef );
if ( luksFs ) if ( luksFs )
{ {
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last(); map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() ); map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
map[ "luksPassphrase" ] = luksFs->passphrase(); map[ "luksPassphrase" ] = luksFs->passphrase();
cDebug() << "luksMapperName:" << map[ "luksMapperName" ]; cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
@ -195,10 +198,12 @@ FillGlobalStorageJob::exec()
QVariant var = createBootLoaderMap(); QVariant var = createBootLoaderMap();
if ( !var.isValid() ) if ( !var.isValid() )
cDebug() << "Failed to find path for boot loader"; cDebug() << "Failed to find path for boot loader";
cDebug() << "FillGlobalStorageJob writing bootLoader path:" << var;
storage->insert( "bootLoader", var ); storage->insert( "bootLoader", var );
} }
else else
{ {
cDebug() << "FillGlobalStorageJob writing empty bootLoader value";
storage->insert( "bootLoader", QVariant() ); storage->insert( "bootLoader", QVariant() );
} }
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();

View File

@ -93,7 +93,7 @@ public:
break; break;
case FileSystem::cmdSupportFileSystem: case FileSystem::cmdSupportFileSystem:
{ {
qint64 byteLength = m_device->logicalSectorSize() * m_length; qint64 byteLength = m_device->logicalSize() * m_length;
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength ); bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
if ( !ok ) if ( !ok )
return Calamares::JobResult::error( return Calamares::JobResult::error(

View File

@ -44,7 +44,15 @@ SetPartFlagsJob::SetPartFlagsJob( Device* device,
QString QString
SetPartFlagsJob::prettyName() const SetPartFlagsJob::prettyName() const
{ {
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() ); if ( !partition()->partitionPath().isEmpty() )
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Set flags on %1MB %2 partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() );
return tr( "Set flags on new partition." );
} }
@ -53,13 +61,34 @@ SetPartFlagsJob::prettyDescription() const
{ {
QStringList flagsList = PartitionTable::flagNames( m_flags ); QStringList flagsList = PartitionTable::flagNames( m_flags );
if ( flagsList.count() == 0 ) if ( flagsList.count() == 0 )
return tr( "Clear flags on partition <strong>%1</strong>." ) {
.arg( partition()->partitionPath() ); if ( !partition()->partitionPath().isEmpty() )
return tr( "Clear flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
return tr( "Flag partition <strong>%1</strong> as " if ( !partition()->fileSystem().name().isEmpty() )
"<strong>%2</strong>." ) return tr( "Clear flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->partitionPath() ) .arg( partition()->capacity() /1024 /1024)
.arg( flagsList.join( ", " ) ); .arg( partition()->fileSystem().name() );
return tr( "Clear flags on new partition." );
}
if ( !partition()->partitionPath().isEmpty() )
return tr( "Flag partition <strong>%1</strong> as "
"<strong>%2</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Flag %1MB <strong>%2</strong> partition as "
"<strong>%3</strong>." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) );
return tr( "Flag new partition as <strong>%1</strong>." )
.arg( flagsList.join( ", " ) );
} }
@ -68,13 +97,34 @@ SetPartFlagsJob::prettyStatusMessage() const
{ {
QStringList flagsList = PartitionTable::flagNames( m_flags ); QStringList flagsList = PartitionTable::flagNames( m_flags );
if ( flagsList.count() == 0 ) if ( flagsList.count() == 0 )
return tr( "Clearing flags on partition <strong>%1</strong>." ) {
.arg( partition()->partitionPath() ); if ( !partition()->partitionPath().isEmpty() )
return tr( "Clearing flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
return tr( "Setting flags <strong>%2</strong> on partition " if ( !partition()->fileSystem().name().isEmpty() )
"<strong>%1</strong>." ) return tr( "Clearing flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->partitionPath() ) .arg( partition()->capacity() /1024 /1024)
.arg( flagsList.join( ", " ) ); .arg( partition()->fileSystem().name() );
return tr( "Clearing flags on new partition." );
}
if ( !partition()->partitionPath().isEmpty() )
return tr( "Setting flags <strong>%2</strong> on partition "
"<strong>%1</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Setting flags <strong>%3</strong> on "
"%1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) );
return tr( "Setting flags <strong>%1</strong> on new partition." )
.arg( flagsList.join( ", " ) );
} }

View File

@ -15,3 +15,6 @@ targets:
disable: disable:
- name: "pacman-init" - name: "pacman-init"
mandatory: false mandatory: false
# Example to express an empty list:
# disable: []

View File

@ -6,7 +6,7 @@ calamares_add_plugin( summary
SummaryViewStep.cpp SummaryViewStep.cpp
SummaryPage.cpp SummaryPage.cpp
UI UI
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
SHARED_LIB SHARED_LIB
) )

View File

@ -19,7 +19,7 @@ calamares_add_plugin( users
gui/adduserdialog.ui gui/adduserdialog.ui
RESOURCES RESOURCES
users.qrc users.qrc
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
${CRYPT_LIBRARIES} ${CRYPT_LIBRARIES}
SHARED_LIB SHARED_LIB

View File

@ -12,5 +12,4 @@ The following settings are available in **users.conf**:
- ```sudoersGroup```: group for sudoers usage. - ```sudoersGroup```: group for sudoers usage.
- ```setRootPassword```: allow to set the root password in the installed system. Defaults to false. - ```setRootPassword```: allow to set the root password in the installed system. Defaults to false.
- ```availableShells```: comma-separated list of available shells for new users. If not present, new users will not have any explicit shell in /etc/passwd, therefore the system default (usually, /bin/bash) will be used. - ```availableShells```: comma-separated list of available shells for new users. If not present, new users will not have any explicit shell in /etc/passwd, therefore the system default (usually, /bin/bash) will be used.
- ```avatarFilePath```: path where to copy user avatars to; ~ can be used to represent the user's home directory. If not present or empty, we won't allow users to set avatars. - ```avatarFilePath```: path where to copy the user avatar to, including the target file name; ~ can be used to represent the user's home directory; $HOME or other environment variables are not currently supported. If a path is not present or empty, we won't allow users to set avatars.

View File

@ -22,6 +22,7 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "utils/Logger.h"
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin<UsersViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin<UsersViewStep>(); )
@ -161,9 +162,14 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
} }
if ( configurationMap.contains( "availableShells" ) && if ( configurationMap.contains( "availableShells" ) &&
configurationMap.value( "availableShells" ).type() == QVariant::List ) configurationMap.value( "availableShells" ).type() == QVariant::String )
{ {
m_widget->setAvailableShells( configurationMap.value( "availableShells" ).toStringList() ); QStringList shells;
for (QString& shell : configurationMap.value( "availableShells" ).toString().split(",")) {
shells.append( shell.trimmed() );
}
m_widget->setAvailableShells(shells);
} }
if ( configurationMap.contains( "avatarFilePath" ) && if ( configurationMap.contains( "avatarFilePath" ) &&

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>712</width> <width>712</width>
<height>383</height> <height>388</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -376,6 +376,12 @@ as the Administrator password</string>
<tabstop>userNameLine</tabstop> <tabstop>userNameLine</tabstop>
<tabstop>passLine</tabstop> <tabstop>passLine</tabstop>
<tabstop>confirmPassLine</tabstop> <tabstop>confirmPassLine</tabstop>
<tabstop>nameLine</tabstop>
<tabstop>autoLoginCheckBox</tabstop>
<tabstop>rootUsesUserPwCheckBox</tabstop>
<tabstop>loginShellSelection</tabstop>
<tabstop>selectImageButton</tabstop>
<tabstop>avatarFileLine</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -44,7 +44,7 @@ calamares_add_plugin( webview
EXPORT_MACRO PLUGINDLLEXPORT_PRO EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES SOURCES
WebViewStep.cpp WebViewStep.cpp
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
${CALA_WEBVIEW_LINK_LIBRARIES} ${CALA_WEBVIEW_LINK_LIBRARIES}
SHARED_LIB SHARED_LIB
) )

View File

@ -25,6 +25,7 @@
#include <QWebView> #include <QWebView>
#else #else
#include <QWebEngineView> #include <QWebEngineView>
#include <QtWebEngine>
#endif #endif
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
@ -33,6 +34,9 @@ WebViewStep::WebViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
{ {
emit nextStatusChanged( true ); emit nextStatusChanged( true );
#ifdef WEBVIEW_WITH_WEBENGINE
QtWebEngine::initialize();
#endif
m_view = new C_QWEBVIEW(); m_view = new C_QWEBVIEW();
#ifdef WEBVIEW_WITH_WEBKIT #ifdef WEBVIEW_WITH_WEBKIT
m_view->settings()->setFontFamily( QWebSettings::StandardFont, m_view->settings()->setFontFamily( QWebSettings::StandardFont,

View File

@ -26,7 +26,7 @@ calamares_add_plugin( welcome
WelcomePage.cpp WelcomePage.cpp
UI UI
WelcomePage.ui WelcomePage.ui
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
${CHECKER_LINK_LIBRARIES} ${CHECKER_LINK_LIBRARIES}
SHARED_LIB SHARED_LIB

View File

@ -338,7 +338,9 @@ bool
RequirementsChecker::checkHasInternet() RequirementsChecker::checkHasInternet()
{ {
// default to true in the QNetworkAccessManager::UnknownAccessibility case // default to true in the QNetworkAccessManager::UnknownAccessibility case
return QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible; bool hasInternet = QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible;
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
return hasInternet;
} }