diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 156ab2cc6..608768a97 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -128,7 +128,12 @@ if ( KPMcore_FOUND ) find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore - if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0" ) + if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" ) + add_definitions( + -DWITH_KPMCORE42API + -DWITH_KPMCORE4API + ) # kpmcore 4.2 with new API + elseif( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0" ) add_definitions( -DWITH_KPMCORE4API ) # kpmcore 4 with new API elseif( KPMcore_VERSION VERSION_GREATER "3.3.70" ) message( FATAL_ERROR "KPMCore beta versions ${KPMcore_VERSION} not supported" ) diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index 1f4260518..6808f1bea 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -8,7 +8,9 @@ set( _partition_defs "" ) if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition ) - if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0" ) + if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" ) + list( APPEND _partition_defs WITH_KPMCORE42API WITH_KPMCORE4API ) # kpmcore 4.2 with new API + elseif( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0" ) list( APPEND _partition_defs WITH_KPMCORE4API ) # kpmcore 4 with new API elseif( KPMcore_VERSION VERSION_GREATER "3.3.70" ) message( FATAL_ERROR "KPMCore beta versions ${KPMcore_VERSION} are not supported" ) diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index 2ac926346..2f9474a29 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -33,6 +33,9 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND if ( KPMcore_VERSION VERSION_GREATER "3.90") list( APPEND _partition_defs WITH_KPMCORE4API) # kpmcore 4 with new API endif() + if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" ) + list( APPEND _partition_defs WITH_KPMCORE42API) # kpmcore 4.2 with new API + endif() include_directories( ${KPMCORE_INCLUDE_DIR} ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 5d4d8f3cd..c3839f5ce 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -882,6 +882,7 @@ PartitionCoreModule::initLayout( const QVariantList& config ) } if ( !m_partLayout->addEntry( CalamaresUtils::getString( pentry, "name" ), + CalamaresUtils::getString( pentry, "type" ), CalamaresUtils::getString( pentry, "mountPoint" ), CalamaresUtils::getString( pentry, "filesystem" ), sizeString, diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index 23332f3f5..d67811ca2 100644 --- a/src/modules/partition/core/PartitionLayout.cpp +++ b/src/modules/partition/core/PartitionLayout.cpp @@ -118,6 +118,7 @@ PartitionLayout::addEntry( const QString& mountPoint, const QString& size, const bool PartitionLayout::addEntry( const QString& label, + const QString& type, const QString& mountPoint, const QString& fs, const QString& size, @@ -138,6 +139,7 @@ PartitionLayout::addEntry( const QString& label, } entry.partLabel = label; + entry.partType = type; entry.partMountPoint = mountPoint; PartUtils::findFS( fs, &entry.partFileSystem ); if ( entry.partFileSystem == FileSystem::Unknown ) @@ -239,6 +241,14 @@ PartitionLayout::execute( Device* dev, { currentPartition->fileSystem().setLabel( part.partLabel ); } + if ( !part.partType.isEmpty() ) + { +#if defined( WITH_KPMCORE42API ) + currentPartition->setType( part.partType ); +#else + cWarning() << "Ignoring type; requires KPMcore >= 4.2.0."; +#endif + } // 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. partList.append( currentPartition ); diff --git a/src/modules/partition/core/PartitionLayout.h b/src/modules/partition/core/PartitionLayout.h index 50bb1ba43..538eb3a3b 100644 --- a/src/modules/partition/core/PartitionLayout.h +++ b/src/modules/partition/core/PartitionLayout.h @@ -40,6 +40,7 @@ public: struct PartitionEntry { QString partLabel; + QString partType; QString partMountPoint; FileSystem::Type partFileSystem = FileSystem::Unknown; CalamaresUtils::Partition::PartitionSize partSize; @@ -73,6 +74,7 @@ public: const QString& min = QString(), const QString& max = QString() ); bool addEntry( const QString& label, + const QString& type, const QString& mountPoint, const QString& fs, const QString& size, diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 6fbb44cb4..d366ad4f0 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -96,12 +96,14 @@ defaultFileSystemType: "ext4" # # partitionLayout: # - name: "rootfs" +# type: "4f68bce3-e8cd-4db1-96e7-fbcaf984b709" # filesystem: "ext4" # mountPoint: "/" # size: 20% # minSize: 500M # maxSize: 10G # - name: "home" +# type = "933ac7e1-2eb4-4f13-b844-0e14e2aef915" # filesystem: "ext4" # mountPoint: "/home" # size: 3G @@ -113,6 +115,7 @@ defaultFileSystemType: "ext4" # # There can be any number of partitions, each entry having the following attributes: # - name: partition label +# - type: partition type (optional parameter; gpt only; requires KPMCore >= 4.2.0) # - filesystem: filesystem type # - mountPoint: partition mount point # - size: partition size in bytes (append 'K', 'M' or 'G' for KiB, MiB or GiB)