[partition] Add support for filesystem-specific features

main
Gaël PORTAY 5 years ago
parent 2eb84e2de1
commit 15cce29a51

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

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

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

@ -834,6 +834,7 @@ PartitionCoreModule::initLayout()
void
PartitionCoreModule::initLayout( const QVariantList& config )
{
bool ok;
QString sizeString;
QString minSizeString;
QString maxSizeString;
@ -884,6 +885,7 @@ PartitionCoreModule::initLayout( const QVariantList& config )
if ( !m_partLayout->addEntry( CalamaresUtils::getString( pentry, "name" ),
CalamaresUtils::getString( pentry, "mountPoint" ),
CalamaresUtils::getString( pentry, "filesystem" ),
CalamaresUtils::getSubMap( pentry, "features", ok ),
sizeString,
minSizeString,
maxSizeString ) )

@ -120,6 +120,7 @@ bool
PartitionLayout::addEntry( const QString& label,
const QString& mountPoint,
const QString& fs,
const QVariantMap& features,
const QString& size,
const QString& min,
const QString& max )
@ -144,6 +145,7 @@ PartitionLayout::addEntry( const QString& label,
{
entry.partFileSystem = m_defaultFsType;
}
entry.partFeatures = features;
m_partLayout.append( entry );
@ -239,6 +241,15 @@ PartitionLayout::execute( Device* dev,
{
currentPartition->fileSystem().setLabel( part.partLabel );
}
if ( !part.partFeatures.isEmpty() )
{
#if defined( WITH_KPMCORE42API )
for ( const auto& k : part.partFeatures.keys() )
currentPartition->fileSystem().addFeature( k, part.partFeatures.value(k) );
#else
cWarning() << "Ignoring features; 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 );

@ -31,6 +31,7 @@
// Qt
#include <QList>
#include <QObject>
#include <QVariantMap>
class Partition;
@ -42,6 +43,7 @@ public:
QString partLabel;
QString partMountPoint;
FileSystem::Type partFileSystem = FileSystem::Unknown;
QVariantMap partFeatures;
CalamaresUtils::Partition::PartitionSize partSize;
CalamaresUtils::Partition::PartitionSize partMinSize;
CalamaresUtils::Partition::PartitionSize partMaxSize;
@ -75,6 +77,7 @@ public:
bool addEntry( const QString& label,
const QString& mountPoint,
const QString& fs,
const QVariantMap& features,
const QString& size,
const QString& min = QString(),
const QString& max = QString() );

@ -106,9 +106,15 @@ defaultFileSystemType: "ext4"
# mountPoint: "/home"
# size: 3G
# minSize: 1.5G
# features:
# 64bit: false
# casefold: true
# - name: "data"
# filesystem: "fat32"
# mountPoint: "/data"
# features:
# sector-size: 4096
# sectors-per-cluster: 128
# size: 100%
#
# There can be any number of partitions, each entry having the following attributes:
@ -120,6 +126,8 @@ defaultFileSystemType: "ext4"
# % of the available drive space if a '%' is appended to the value
# - minSize: minimum partition size (optional parameter)
# - maxSize: maximum partition size (optional parameter)
# - features: filesystem features (optional parameter; requires KPMCore >= 4.2.0)
# name: boolean or integer or string
# Checking for available storage
#

Loading…
Cancel
Save