Fix creation of encrypted volumes

We can't rely on the order of lsblk. Check for the type=crypt instead.

BUG: 379205
This commit is contained in:
Christian Morlok 2017-04-05 15:14:46 +02:00 committed by Andrius Štikonas
parent bd3a469b0b
commit b10577e1c7
1 changed files with 4 additions and 5 deletions

View File

@ -562,13 +562,12 @@ void luks::getMapperName(const QString& deviceNode)
{ QStringLiteral("--list"),
QStringLiteral("--noheadings"),
QStringLiteral("--output"),
QStringLiteral("name"),
QStringLiteral("type,name"),
deviceNode });
if (cmd.run(-1) && cmd.exitCode() == 0) {
QStringList output=cmd.output().split(QStringLiteral("\n"));
output.removeFirst();
if (!output.first().isEmpty())
m_MapperName = QStringLiteral("/dev/mapper/") + output.first();
QStringList output=cmd.output().split(QStringLiteral("\n")).filter(QRegularExpression(QStringLiteral("^crypt ")));
if (!output.isEmpty() && !output.first().isEmpty())
m_MapperName = QStringLiteral("/dev/mapper/") + output.first().split(QStringLiteral(" ")).last();
}
else
m_MapperName = QString();