[libcalamares] Special-case for not-for-dash-o options

- The unpackfs module uses this to --bind-mount things
   without options.
This commit is contained in:
Adriaan de Groot 2019-06-21 10:43:52 +02:00
parent 5597215d58
commit 08537823ae
2 changed files with 12 additions and 2 deletions

View File

@ -58,16 +58,24 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
}
}
QStringList args = { "mount", devicePath, mountPoint };
QStringList args = { "mount" };
if ( !filesystemName.isEmpty() )
{
args << "-t" << filesystemName;
}
if ( !options.isEmpty() )
{
if ( options.startsWith( '-' ) )
{
args << options;
}
else
{
args << "-o" << options;
}
}
args << devicePath << mountPoint;
auto r = CalamaresUtils::System::runCommand( args, 10 );
sync();

View File

@ -36,6 +36,8 @@ namespace Partition
* @param mountPoint the full path of the target mount point.
* @param filesystemName the name of the filesystem (optional).
* @param options any additional options as passed to mount -o (optional).
* If @p options starts with a dash (-) then it is passed unchanged
* and no -o option is added; this is used in handling --bind mounts.
* @returns the program's exit code, or:
* Crashed = QProcess crash
* FailedToStart = QProcess cannot start