Compare commits

...

18 Commits

Author SHA1 Message Date
Teo Mrnjavac
755a56914d Don't assume 'User' exists in autologin section. 2017-01-19 17:04:50 +01:00
Teo Mrnjavac
ef04515011 Bump. 2017-01-13 18:16:47 +01:00
Teo Mrnjavac
8e842efd66 Force the correct flags for EFI system partition. 2017-01-12 16:52:55 +01:00
Teo Mrnjavac
21a6459611 Make sure to disable the root password if setRootPassword is false.
CAL-442 #comment Backported to 2.4.x-stable.
2017-01-12 13:47:05 +01:00
Teo Mrnjavac
a81c8137b2 The sender QObject should be in scope so the bootloader path is written.
CAL-388
CAL-417
CAL-441
2017-01-11 11:50:40 +01:00
Teo Mrnjavac
1c946bf365 Improve debug output. 2016-12-23 14:17:39 +01:00
Teo Mrnjavac
67bd3306f8 Improve debug output. 2016-12-23 14:04:12 +01:00
Teo Mrnjavac
89f078f8c5 Alignment. 2016-12-22 13:53:17 +01:00
demmm
6e2d445888 fix crash on loading webview page with QtWebengine 2016-12-22 13:53:09 +01:00
Teo Mrnjavac
bdda452f66 ifdef all the things so we can build with both KPMcore 3 and 2.2. 2016-12-21 13:59:17 +01:00
Teo Mrnjavac
50187261c3 Expose KPMcore version status to partition module. 2016-12-21 13:58:17 +01:00
Teo Mrnjavac
1f37f3dda0 Do not dereference nullptr. 2016-12-13 12:16:56 +01:00
Teo Mrnjavac
d7302ca024 Provide default for m_writeEtcDefaultKeyboard in KeyboardViewStep. 2016-12-13 12:10:40 +01:00
Teo Mrnjavac
92e1233279 Write hasInternet to GlobalStorage.
CAL-431 #close
2016-12-12 13:38:28 +01:00
Teo Mrnjavac
4a50f5ae54 Do not LINK_PUBLIC by default. 2016-12-07 16:40:04 +01:00
Teo Mrnjavac
fe75e980f5 Add LINK_PRIVATE_LIBRARIES to calamares_add_plugin. 2016-12-07 16:39:57 +01:00
Teo Mrnjavac
7a67eed918 Document settings for services module. 2016-12-05 18:01:12 +01:00
Kevin Kofler
b4fb2115dc [displaymanager] set_autologin: Unset autologin for sddm when needed
CAL-423 #close
2016-12-03 19:20:29 +01:00
34 changed files with 168 additions and 37 deletions

View File

@@ -102,7 +102,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX
### Bump version here ### Bump version here
set( CALAMARES_VERSION_MAJOR 2 ) set( CALAMARES_VERSION_MAJOR 2 )
set( CALAMARES_VERSION_MINOR 4 ) set( CALAMARES_VERSION_MINOR 4 )
set( CALAMARES_VERSION_PATCH 5 ) set( CALAMARES_VERSION_PATCH 6 )
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} )

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

@@ -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

@@ -43,10 +43,11 @@ 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}
RESOURCES libcalamaresui.qrc RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends EXPORT CalamaresLibraryDepends
VERSION ${CALAMARES_VERSION_SHORT} VERSION ${CALAMARES_VERSION_SHORT}

View File

@@ -267,15 +267,13 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
if do_autologin: if do_autologin:
autologin_section['User'] = username autologin_section['User'] = username
elif 'User' in autologin_section:
del autologin_section['User']
if default_desktop_environment is not None: if default_desktop_environment is not None:
autologin_section['Session'] = default_desktop_environment.desktop_file autologin_section['Session'] = default_desktop_environment.desktop_file
if autologin_section: sddm_config['Autologin'] = autologin_section
if 'Autologin' in sddm_config:
sddm_config['Autologin'].update(autologin_section)
else:
sddm_config['Autologin'] = autologin_section
with open(sddm_conf_path, 'w') as sddm_config_file: with open(sddm_conf_path, 'w') as sddm_config_file:
sddm_config.write(sddm_config_file, space_around_delimiters=False) sddm_config.write(sddm_config_file, space_around_delimiters=False)

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

@@ -11,6 +11,13 @@ find_package( KF5 REQUIRED CoreAddons )
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 2.2 REQUIRED )
if(KPMcore_VERSION VERSION_LESS 3.0.0)
set(WITH_KPMCORE3 OFF)
else()
set(WITH_KPMCORE3 ON)
endif()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/PartitionConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/PartitionConfig.h )
add_subdirectory( tests ) add_subdirectory( tests )
@@ -66,7 +73,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

@@ -0,0 +1,6 @@
#ifndef CALAMARESPARTITIONCONFIG_H
#define CALAMARESPARTITIONCONFIG_H
#cmakedefine WITH_KPMCORE3
#endif // CALAMARESPARTITIONCONFIG_H

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

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, 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
@@ -26,6 +26,7 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "PartitionConfig.h"
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
@@ -128,11 +129,19 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
empty_space_size = 1; empty_space_size = 1;
} }
#ifdef WITH_KPMCORE3
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSize() + 1;
#else
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1; qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1;
#endif
if ( isEfi ) if ( isEfi )
{ {
#ifdef WITH_KPMCORE3
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
#else
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() ); qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
#endif
core->createPartitionTable( dev, PartitionTable::gpt ); core->createPartitionTable( dev, PartitionTable::gpt );
Partition* efiPartition = KPMHelpers::createNewPartition( Partition* efiPartition = KPMHelpers::createNewPartition(
dev->partitionTable(), dev->partitionTable(),
@@ -148,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
->globalStorage() ->globalStorage()
->value( "efiSystemPartition" ) ->value( "efiSystemPartition" )
.toString() ); .toString() );
core->createPartition( dev, efiPartition ); core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
firstFreeSector = lastSector + 1; firstFreeSector = lastSector + 1;
} }
else else
@@ -157,7 +166,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
} }
bool shouldCreateSwap = false; bool shouldCreateSwap = false;
#ifdef WITH_KPMCORE3
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
#else
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize(); qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
#endif
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB ); qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB = qint64 requiredSpaceB =
( Calamares::JobQueue::instance()-> ( Calamares::JobQueue::instance()->
@@ -168,11 +181,19 @@ 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;
#ifdef WITH_KPMCORE3
qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap )
{
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1;
}
#else
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device
if ( shouldCreateSwap ) if ( shouldCreateSwap )
{ {
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1; lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
} }
#endif
Partition* rootPartition = nullptr; Partition* rootPartition = nullptr;
if ( luksPassphrase.isEmpty() ) if ( luksPassphrase.isEmpty() )
@@ -213,7 +234,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ), PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap, FileSystem::LinuxSwap,
lastSectorForRoot + 1, lastSectorForRoot + 1,
#ifdef WITH_KPMCORE3
dev->totalLogical() - 1
#else
dev->totalSectors() - 1 dev->totalSectors() - 1
#endif
); );
} }
else else
@@ -224,7 +249,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ), PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap, FileSystem::LinuxSwap,
lastSectorForRoot + 1, lastSectorForRoot + 1,
#ifdef WITH_KPMCORE3
dev->totalLogical() - 1,
#else
dev->totalSectors() - 1, dev->totalSectors() - 1,
#endif
luksPassphrase luksPassphrase
); );
} }

View File

@@ -22,6 +22,7 @@
#include "core/PartitionInfo.h" #include "core/PartitionInfo.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "PartitionConfig.h"
// CalaPM // CalaPM
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
@@ -148,7 +149,11 @@ PartitionModel::data( const QModelIndex& index, int role ) const
return PartitionInfo::mountPoint( partition ); return PartitionInfo::mountPoint( partition );
if ( col == SizeColumn ) if ( col == SizeColumn )
{ {
#ifdef WITH_KPMCORE3
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
return KFormat().formatByteSize( size ); return KFormat().formatByteSize( size );
} }
cDebug() << "Unknown column" << col; cDebug() << "Unknown column" << col;
@@ -175,12 +180,20 @@ PartitionModel::data( const QModelIndex& index, int role ) const
} }
} }
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() ); QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
#ifdef WITH_KPMCORE3
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
QString prettySize = KFormat().formatByteSize( size ); QString prettySize = KFormat().formatByteSize( size );
return QVariant(name + " " + prettyFileSystem + " " + prettySize); return QVariant(name + " " + prettyFileSystem + " " + prettySize);
} }
case SizeRole: case SizeRole:
#ifdef WITH_KPMCORE3
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
case IsFreeSpaceRole: case IsFreeSpaceRole:
return KPMHelpers::isPartitionFreeSpace( partition ); return KPMHelpers::isPartitionFreeSpace( partition );

View File

@@ -35,6 +35,7 @@
#include "BootInfoWidget.h" #include "BootInfoWidget.h"
#include "DeviceInfoWidget.h" #include "DeviceInfoWidget.h"
#include "ScanningDialog.h" #include "ScanningDialog.h"
#include "PartitionConfig.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -594,7 +595,11 @@ ChoicePage::doAlongsideApply()
qint64 oldLastSector = candidate->lastSector(); qint64 oldLastSector = candidate->lastSector();
qint64 newLastSector = firstSector + qint64 newLastSector = firstSector +
m_afterPartitionSplitterWidget->splitPartitionSize() / m_afterPartitionSplitterWidget->splitPartitionSize() /
#ifdef WITH_KPMCORE3
dev->logicalSize();
#else
dev->logicalSectorSize(); dev->logicalSectorSize();
#endif
m_core->resizePartition( dev, candidate, firstSector, newLastSector ); m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = nullptr; Partition* newPartition = nullptr;
@@ -1106,7 +1111,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

@@ -21,6 +21,7 @@
#include <core/PartitionModel.h> #include <core/PartitionModel.h>
#include <core/ColorUtils.h> #include <core/ColorUtils.h>
#include "PartitionConfig.h"
#include <utils/CalamaresUtilsGui.h> #include <utils/CalamaresUtilsGui.h>
#include <utils/Logger.h> #include <utils/Logger.h>
@@ -47,7 +48,11 @@ 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" ),
#ifdef WITH_KPMCORE3
KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) };
#else
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) }; KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) };
#endif
return texts; return texts;
} }

View File

@@ -21,6 +21,7 @@
#include "core/ColorUtils.h" #include "core/ColorUtils.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "PartitionConfig.h"
// Qt // Qt
#include <QSpinBox> #include <QSpinBox>
@@ -135,7 +136,11 @@ PartitionSizeController::updatePartResizerWidget()
return; return;
m_updating = true; m_updating = true;
#ifdef WITH_KPMCORE3
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize();
#else
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize(); qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
#endif
qint64 firstSector = m_partition->firstSector(); qint64 firstSector = m_partition->firstSector();
qint64 lastSector = firstSector + sectorSize - 1; qint64 lastSector = firstSector + sectorSize - 1;
@@ -185,7 +190,11 @@ PartitionSizeController::doUpdateSpinBox()
{ {
if ( !m_spinBox ) if ( !m_spinBox )
return; return;
#ifdef WITH_KPMCORE3
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
#else
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024; qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024;
#endif
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

@@ -26,6 +26,7 @@
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "Branding.h" #include "Branding.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "PartitionConfig.h"
// CalaPM // CalaPM
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
@@ -98,7 +99,11 @@ 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 )
{ {
#ifdef WITH_KPMCORE3
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
#else
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last(); map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last();
#endif
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" ];

View File

@@ -44,6 +44,7 @@
#include "jobs/CheckFileSystemJob.h" #include "jobs/CheckFileSystemJob.h"
#include "jobs/MoveFileSystemJob.h" #include "jobs/MoveFileSystemJob.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "PartitionConfig.h"
// KPMcore // KPMcore
#include <kpmcore/backend/corebackend.h> #include <kpmcore/backend/corebackend.h>
@@ -93,7 +94,11 @@ public:
break; break;
case FileSystem::cmdSupportFileSystem: case FileSystem::cmdSupportFileSystem:
{ {
#ifdef WITH_KPMCORE3
qint64 byteLength = m_device->logicalSize() * m_length;
#else
qint64 byteLength = m_device->logicalSectorSize() * m_length; qint64 byteLength = m_device->logicalSectorSize() * m_length;
#endif
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

@@ -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

@@ -16,7 +16,7 @@ calamares_add_plugin( users
page_usersetup.ui page_usersetup.ui
RESOURCES RESOURCES
users.qrc users.qrc
LINK_LIBRARIES LINK_PRIVATE_LIBRARIES
calamaresui calamaresui
${CRYPT_LIBRARIES} ${CRYPT_LIBRARIES}
SHARED_LIB SHARED_LIB

View File

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, 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
@@ -59,6 +59,20 @@ SetPasswordJob::exec()
return Calamares::JobResult::error( tr( "Bad destination system path." ), return Calamares::JobResult::error( tr( "Bad destination system path." ),
tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) ); tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) );
if ( m_userName == "root" &&
m_newPassword.isEmpty() ) //special case for disabling root account
{
int ec = CalamaresUtils::System::instance()->
targetEnvCall( { "passwd",
"-dl",
m_userName } );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot disable root account." ),
tr( "passwd terminated with error code %1." )
.arg( ec ) );
return Calamares::JobResult::ok();
}
QString encrypted = QString::fromLatin1( QString encrypted = QString::fromLatin1(
crypt( m_newPassword.toLatin1(), crypt( m_newPassword.toLatin1(),
QString( "$6$%1$" ) QString( "$6$%1$" )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* *
* Portions from the Manjaro Installation Framework * Portions from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org> * by Roland Singer <roland@manjaro.org>
@@ -138,6 +138,12 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
ui->textBoxRootPassword->text() ); ui->textBoxRootPassword->text() );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );
} }
else
{
j = new SetPasswordJob( "root",
"" ); //explicitly disable root password
list.append( Calamares::job_ptr( j ) );
}
j = new SetHostNameJob( ui->textBoxHostname->text() ); j = new SetHostNameJob( ui->textBoxHostname->text() );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );

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;
} }