From c93d83dfb2e45c5d144600e4e9d264142b4d8f18 Mon Sep 17 00:00:00 2001 From: "Tobias C. Berner" Date: Tue, 5 Sep 2017 22:22:55 +0200 Subject: [PATCH] Add support for the normal 'umount' porgram. Summary: FreeBSD does not install fusermount, so we need to use 'umount'. Reviewers: #kde_connect, albertvaka Reviewed By: #kde_connect, albertvaka Subscribers: albertvaka, #kde_connect Differential Revision: https://phabricator.kde.org/D6945 --- plugins/sftp/CMakeLists.txt | 4 ++++ plugins/sftp/config-sftp.h.cmake | 1 + plugins/sftp/mounter.cpp | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 plugins/sftp/config-sftp.h.cmake diff --git a/plugins/sftp/CMakeLists.txt b/plugins/sftp/CMakeLists.txt index 84e014dd2..746904867 100644 --- a/plugins/sftp/CMakeLists.txt +++ b/plugins/sftp/CMakeLists.txt @@ -1,3 +1,7 @@ +# Find fusermount -- otherwise fallback to umount +find_program(HAVE_FUSERMOUNT fusermount) +configure_file(config-sftp.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-sftp.h ) + find_package(KF5 REQUIRED COMPONENTS Notifications KIO) set(kdeconnect_sftp_SRCS diff --git a/plugins/sftp/config-sftp.h.cmake b/plugins/sftp/config-sftp.h.cmake new file mode 100644 index 000000000..0692c2699 --- /dev/null +++ b/plugins/sftp/config-sftp.h.cmake @@ -0,0 +1 @@ +#cmakedefine01 HAVE_FUSERMOUNT diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index c2e7d6dee..14114092d 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -27,6 +27,7 @@ #include #include "mountloop.h" +#include "config-sftp.h" #include "sftp_debug.h" #include "kdeconnectconfig.h" @@ -234,7 +235,11 @@ void Mounter::unmount(bool finished) m_proc->deleteLater(); //Free mount point (won't always succeed if the path is in use) +#if defined(HAVE_FUSERMOUNT) KProcess::execute(QStringList() << QStringLiteral("fusermount") << QStringLiteral("-u") << m_mountPoint, 10000); +#else + KProcess::execute(QStringList() << QStringLiteral("umount") << m_mountPoint, 10000); +#endif m_proc = nullptr; } m_started = false;