[libcalamares] Add unmount helper function

This commit is contained in:
Adriaan de Groot 2019-06-20 13:52:36 +02:00
parent 6ba8ac8526
commit e59b3e8bf5
2 changed files with 19 additions and 1 deletions

View File

@ -69,10 +69,19 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
args << "-o" << options;
}
auto r = CalamaresUtils::System::instance()->runCommand( args, 10 );
auto r = CalamaresUtils::System::runCommand( args, 10 );
sync();
return r.getExitCode();
}
int
unmount( const QString& path, const QStringList& options )
{
auto r = CalamaresUtils::System::runCommand( QStringList { "umount" } << options << path, 10 );
sync();
return r.getExitCode();
}
} // namespace Partition
} // namespace CalamaresUtils

View File

@ -23,6 +23,7 @@
#include "DllMacro.h"
#include <QString>
#include <QStringList>
namespace CalamaresUtils
{
@ -44,6 +45,14 @@ DLLEXPORT int mount( const QString& devicePath,
const QString& mountPoint,
const QString& filesystemName = QString(),
const QString& options = QString() );
/** @brief Unmount the given @p path (device or mount point).
*
* Runs umount(8) in the host system.
*
* @returns the program's exit codeor special codes like mount().
*/
DLLEXPORT int unmount( const QString& path, const QStringList& options = QStringList() );
} // namespace Partition
} // namespace CalamaresUtils