diff --git a/src/libcalamares/partition/Mount.cpp b/src/libcalamares/partition/Mount.cpp index c1e34b89b..fa7a49c0e 100644 --- a/src/libcalamares/partition/Mount.cpp +++ b/src/libcalamares/partition/Mount.cpp @@ -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 diff --git a/src/libcalamares/partition/Mount.h b/src/libcalamares/partition/Mount.h index 18f65ef76..1053d85b0 100644 --- a/src/libcalamares/partition/Mount.h +++ b/src/libcalamares/partition/Mount.h @@ -23,6 +23,7 @@ #include "DllMacro.h" #include +#include 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