[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,7 +58,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
} }
} }
QStringList args = { "mount", devicePath, mountPoint }; QStringList args = { "mount" };
if ( !filesystemName.isEmpty() ) if ( !filesystemName.isEmpty() )
{ {
@ -66,8 +66,16 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
} }
if ( !options.isEmpty() ) if ( !options.isEmpty() )
{ {
args << "-o" << options; if ( options.startsWith( '-' ) )
{
args << options;
}
else
{
args << "-o" << options;
}
} }
args << devicePath << mountPoint;
auto r = CalamaresUtils::System::runCommand( args, 10 ); auto r = CalamaresUtils::System::runCommand( args, 10 );
sync(); sync();

View File

@ -36,6 +36,8 @@ namespace Partition
* @param mountPoint the full path of the target mount point. * @param mountPoint the full path of the target mount point.
* @param filesystemName the name of the filesystem (optional). * @param filesystemName the name of the filesystem (optional).
* @param options any additional options as passed to mount -o (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: * @returns the program's exit code, or:
* Crashed = QProcess crash * Crashed = QProcess crash
* FailedToStart = QProcess cannot start * FailedToStart = QProcess cannot start