From da6f728cd45a17d759f3f3ef104b77182516c9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Thu, 14 May 2020 12:30:58 -0400 Subject: [PATCH 1/2] [partition] Add support for partition uuid --- src/modules/partition/core/PartitionCoreModule.cpp | 1 + src/modules/partition/core/PartitionLayout.cpp | 6 ++++++ src/modules/partition/core/PartitionLayout.h | 2 ++ src/modules/partition/partition.conf | 1 + 4 files changed, 10 insertions(+) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index aee1ab10f..b3c3409f4 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -883,6 +883,7 @@ PartitionCoreModule::initLayout( const QVariantList& config ) } if ( !m_partLayout->addEntry( CalamaresUtils::getString( pentry, "name" ), + CalamaresUtils::getString( pentry, "uuid" ), CalamaresUtils::getString( pentry, "type" ), CalamaresUtils::getString( pentry, "mountPoint" ), CalamaresUtils::getString( pentry, "filesystem" ), diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index 33d2a7679..451604273 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& uuid, const QString& type, const QString& mountPoint, const QString& fs, @@ -140,6 +141,7 @@ PartitionLayout::addEntry( const QString& label, } entry.partLabel = label; + entry.partUUID = uuid; entry.partType = type; entry.partMountPoint = mountPoint; PartUtils::findFS( fs, &entry.partFileSystem ); @@ -244,6 +246,10 @@ PartitionLayout::execute( Device* dev, currentPartition->setLabel( part.partLabel ); currentPartition->fileSystem().setLabel( part.partLabel ); } + if ( !part.partUUID.isEmpty() ) + { + currentPartition->setUUID( part.partUUID ); + } if ( !part.partType.isEmpty() ) { #if defined( WITH_KPMCORE42API ) diff --git a/src/modules/partition/core/PartitionLayout.h b/src/modules/partition/core/PartitionLayout.h index 5651ae995..a7bfcc4b9 100644 --- a/src/modules/partition/core/PartitionLayout.h +++ b/src/modules/partition/core/PartitionLayout.h @@ -41,6 +41,7 @@ public: struct PartitionEntry { QString partLabel; + QString partUUID; QString partType; QString partMountPoint; FileSystem::Type partFileSystem = FileSystem::Unknown; @@ -76,6 +77,7 @@ public: const QString& min = QString(), const QString& max = QString() ); bool addEntry( const QString& label, + const QString& uuid, const QString& type, const QString& mountPoint, const QString& fs, diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index f6cc34ee4..158258fc9 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -127,6 +127,7 @@ defaultFileSystemType: "ext4" # - name: filesystem label # and # partition name (gpt only; since KPMCore 4.2.0) +# - uuid: partition uuid (optional parameter; gpt only; requires KPMCore >= 4.2.0) # - type: partition type (optional parameter; gpt only; requires KPMCore >= 4.2.0) # - filesystem: filesystem type # - mountPoint: partition mount point From 3d2b9053b08b41ee9dab70c61a9542324442b35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Thu, 12 Mar 2020 15:27:35 -0400 Subject: [PATCH 2/2] [partition] Add the GPT label and UUID to global storage --- src/modules/partition/jobs/FillGlobalStorageJob.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index 07c856d44..1242b7804 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -91,6 +91,8 @@ mapForPartition( Partition* partition, const QString& uuid ) { QVariantMap map; map[ "device" ] = partition->partitionPath(); + map[ "partlabel" ] = partition->label(); + map[ "partuuid" ] = partition->uuid(); map[ "mountPoint" ] = PartitionInfo::mountPoint( partition ); map[ "fsName" ] = userVisibleFS( partition->fileSystem() ); map[ "fs" ] = untranslatedFS( partition->fileSystem() ); @@ -107,6 +109,7 @@ mapForPartition( Partition* partition, const QString& uuid ) Logger::CDebug deb; using TR = Logger::DebugRow< const char* const, const QString& >; deb << Logger::SubEntry << "mapping for" << partition->partitionPath() << partition->deviceNode() + << TR( "partlabel", map[ "partlabel" ].toString() ) << TR( "partuuid", map[ "partuuid" ].toString() ) << TR( "mountPoint:", PartitionInfo::mountPoint( partition ) ) << TR( "fs:", map[ "fs" ].toString() ) << TR( "fsName", map[ "fsName" ].toString() ) << TR( "uuid", uuid ) << TR( "claimed", map[ "claimed" ].toString() );