Add initial support for dosfstools 4.2.

Empty labels are not allowed anymore.
One can reset them with -r flag but that is not supported in older
dosfstools. So for now we just manually set label to NO_LABEL.

BUG: 432941
This commit is contained in:
Andrius Štikonas 2021-02-19 17:51:43 +00:00
parent 3b87ba9e02
commit 00de130889
1 changed files with 3 additions and 1 deletions

View File

@ -140,7 +140,9 @@ bool fat12::writeLabel(Report& report, const QString& deviceNode, const QString&
{
report.line() << xi18nc("@info:progress", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel.toUpper());
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, newLabel.toUpper() });
// This is needed to support new dosfstool 4.2. Later we can drop dosfstools 4.1 and add -r flag.
const QString label = newLabel.isEmpty() ? QStringLiteral("NO_LABEL") : newLabel;
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, label.toUpper() });
return cmd.run(-1) && cmd.exitCode() == 0;
}