Get luksUuid instead of innerFs UUID.
This commit is contained in:
parent
e1ee6e181a
commit
cd304b7a6f
@ -37,6 +37,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
typedef QHash<QString, QString> UuidForPartitionHash;
|
typedef QHash<QString, QString> UuidForPartitionHash;
|
||||||
|
|
||||||
@ -62,6 +63,22 @@ findPartitionUuids( QList < Device* > devices )
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static QString
|
||||||
|
getLuksUuid( const QString& path )
|
||||||
|
{
|
||||||
|
QProcess process;
|
||||||
|
process.setProgram( "cryptsetup" );
|
||||||
|
process.setArguments( { "luksUUID", path } );
|
||||||
|
process.start();
|
||||||
|
process.waitForFinished();
|
||||||
|
if ( process.exitStatus() != QProcess::NormalExit || process.exitCode() )
|
||||||
|
return QString();
|
||||||
|
QString uuid = QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed();
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static QVariant
|
static QVariant
|
||||||
mapForPartition( Partition* partition, const QString& uuid )
|
mapForPartition( Partition* partition, const QString& uuid )
|
||||||
{
|
{
|
||||||
@ -82,6 +99,7 @@ mapForPartition( Partition* partition, const QString& uuid )
|
|||||||
if ( luksFs )
|
if ( luksFs )
|
||||||
{
|
{
|
||||||
map[ "luksMapperName" ] = luksFs->suggestedMapperName( partition->partitionPath() );
|
map[ "luksMapperName" ] = luksFs->suggestedMapperName( partition->partitionPath() );
|
||||||
|
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
|
||||||
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
|
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user