From 08537823aeef7b9e1ed3f07c35aa87685a4d40c4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 21 Jun 2019 10:43:52 +0200 Subject: [PATCH] [libcalamares] Special-case for not-for-dash-o options - The unpackfs module uses this to --bind-mount things without options. --- src/libcalamares/partition/Mount.cpp | 12 ++++++++++-- src/libcalamares/partition/Mount.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/partition/Mount.cpp b/src/libcalamares/partition/Mount.cpp index 0ab0e26bc..8eed0ce49 100644 --- a/src/libcalamares/partition/Mount.cpp +++ b/src/libcalamares/partition/Mount.cpp @@ -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() ) { @@ -66,8 +66,16 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file } 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 ); sync(); diff --git a/src/libcalamares/partition/Mount.h b/src/libcalamares/partition/Mount.h index 67e310ac3..c8ffd0c23 100644 --- a/src/libcalamares/partition/Mount.h +++ b/src/libcalamares/partition/Mount.h @@ -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