Fix to remove skel directories when uninstalling with keep-rwdata 16/238916/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 20 Jul 2020 08:23:57 +0000 (17:23 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 20 Jul 2020 08:23:57 +0000 (17:23 +0900)
Change-Id: Ic05f1f79c9e9537d2df1cb28f824538db378bb95
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/shared_dirs.cc
src/common/shared_dirs.h
src/common/step/filesystem/step_remove_per_user_storage_directories.cc

index 3621d24..88f1673 100644 (file)
@@ -554,7 +554,8 @@ bool CreatePerUserStorageDirectories(const std::string& pkgid, bool trusted,
   return true;
 }
 
-bool DeletePerUserStorageDirectories(const std::string& pkgid) {
+bool DeletePerUserStorageDirectories(const std::string& pkgid,
+    bool keep_rwdata) {
   // delete skel dir
   bf::path skel_apps_rw = bf::path(tzplatform_getenv(TZ_SYS_ETC)) /
       bf::path(kSkelAppDir);
@@ -563,6 +564,9 @@ bool DeletePerUserStorageDirectories(const std::string& pkgid) {
     return false;
   }
 
+  if (keep_rwdata)
+    return true;
+
   // delete per user dir
   UserList list = ci::GetUserList();
   for (auto l : list) {
index e79aa90..389a552 100644 (file)
@@ -99,10 +99,12 @@ bool CreateStorageDirectories(const boost::filesystem::path& path,
  * \brief Deletes per user storage directories in path
  *
  * \param pkgid package id
+ * \param keep_rwdata keep rwdata flag
  *
  * \return true if succeed, false otherwise
  */
-bool DeletePerUserStorageDirectories(const std::string& pkgid);
+bool DeletePerUserStorageDirectories(const std::string& pkgid,
+                                     bool keep_rwdata = false);
 
 /**
  * \brief Deletes storage directories in path
index be8d19c..9eba913 100644 (file)
@@ -14,11 +14,11 @@ namespace common_installer {
 namespace filesystem {
 
 Step::Status StepRemovePerUserStorageDirectories::process() {
-  if (context_->request_mode.get() != RequestMode::GLOBAL ||
-      context_->keep_rwdata.get())
+  if (context_->request_mode.get() != RequestMode::GLOBAL)
     return Step::Status::OK;
 
-  if (!common_installer::DeletePerUserStorageDirectories(context_->pkgid.get()))
+  if (!common_installer::DeletePerUserStorageDirectories(context_->pkgid.get(),
+          context_->keep_rwdata.get()))
     return Status::APP_DIR_ERROR;
 
   return Step::Status::OK;