Revert "Check if in uninstalled app dirs are mounted files" 80/138680/3
authorjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 13 Jul 2017 07:40:19 +0000 (07:40 +0000)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 13 Jul 2017 08:22:01 +0000 (08:22 +0000)
This reverts commit ea66fe10d96114efdf2f661f9ab363136a57ed9e.

Original commit is for preventing uninstallation before unmount of the mounted point for current target pkg. (actual case : run external installed pkg)
But, We should be able to uninstall pkg regaredless of mount state.
So, New patch should be considered to actually unmount the point in the unistall progress.

Note: there, in the platform, is another chance to unmount all mounted points for external pkg when sdcard is removed.

Change-Id: I013b0bfb4734ec92549de840faa516ddbbf6b783

src/common/step/pkgmgr/step_check_removable.cc

index a127c15..7dd0bc8 100644 (file)
@@ -6,25 +6,8 @@
 
 #include <pkgmgr-info.h>
 
-#include <boost/filesystem/operations.hpp>
-
-#include <pkgmgr_query.h>
-#include <utils/user_util.h>
-
-#include <fstream>
-#include <string>
-#include <vector>
-
 #include "common/app_installer.h"
 
-namespace {
-
-const uid_t kGlobalUserUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
-const gid_t kGlobalUserGid = tzplatform_getgid(TZ_SYS_GLOBALAPP_USER);
-const bf::path kMountsPath = "/proc/mounts";
-
-}
-
 namespace common_installer {
 namespace pkgmgr {
 
@@ -62,54 +45,6 @@ Step::Status StepCheckRemovable::process() {
 Step::Status StepCheckRemovable::precheck() {
   if (context_->pkgid.get().empty())
     return Status::INVALID_VALUE;
-
-  std::string pkgid = context_->pkgid.get();
-  std::ifstream mounts_file;
-  std::vector<std::string> lines;
-
-  mounts_file.open(kMountsPath.string());
-
-  if (!mounts_file.is_open()) {
-    LOG(ERROR) << "File " << kMountsPath << " no open";
-    return Status::ERROR;
-  }
-
-  std::string line;
-  while (mounts_file >> line) {
-    lines.push_back(line);
-  }
-
-  mounts_file.close();
-
-  if (lines.empty()) {
-    return Status::OK;
-  }
-
-  UserList list = GetUserList();
-  list.emplace_back(kGlobalUserUid, kGlobalUserGid,
-                    GetRootAppPath(false, kGlobalUserUid));
-  for (auto l : list) {
-    bf::path pkg_path;
-    if (std::get<0>(l) != kGlobalUserUid) {
-      pkg_path = std::get<2>(l) / "apps_rw" / pkgid;
-    } else {
-      pkg_path = std::get<2>(l) / pkgid;
-    }
-
-    if (!bf::exists(pkg_path))
-      continue;
-    LOG(DEBUG) << "Checking if directories of " << pkgid
-        << ", for uid: " << std::get<0>(l) << ", are removable";
-
-    for (auto d : lines) {
-      if (d.find(pkg_path.string()) != std::string::npos) {
-        LOG(ERROR) << "The directory: " << pkg_path << " contains a mounted " <<
-            "file! Please unmount it before you can uninstall this app!";
-        return Status::OPERATION_NOT_ALLOWED;
-      }
-    }
-  }
-
   return Status::OK;
 }