[partition] Add support for partition type
This commit is contained in:
parent
2eb84e2de1
commit
c5ebe13aeb
@ -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 )
|
||||
|
@ -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,
|
||||
|
@ -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 );
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user