Keep UUID when clearing swap.
CAL-156 #comment I've just pushed a fix attempt for this, please test.
This commit is contained in:
parent
dad7831951
commit
c5f9397d18
@ -200,10 +200,17 @@ QString
|
|||||||
ClearMountsJob::tryClearSwap( const QString& partPath )
|
ClearMountsJob::tryClearSwap( const QString& partPath )
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start( "mkswap", { partPath } );
|
process.start( "blkid", { "-s", "UUID", "-o", "value", partPath } );
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
if ( process.exitCode() == 0 )
|
QString swapPartUuid = QString::fromLocal8Bit( process.readAllStandardOutput() ).simplified();
|
||||||
return QString( "Successfully cleared swap %1." ).arg( partPath );
|
if ( process.exitCode() != 0 ||
|
||||||
|
swapPartUuid.isEmpty() )
|
||||||
|
return QString();
|
||||||
|
|
||||||
return QString();
|
process.start( "mkswap", { "-U", swapPartUuid, partPath } );
|
||||||
|
process.waitForFinished();
|
||||||
|
if ( process.exitCode() != 0 )
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
return QString( "Successfully cleared swap %1." ).arg( partPath );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user