Fix StepRecoverGlobalAppSymlinks 62/167962/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 23 Jan 2018 04:00:05 +0000 (13:00 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 23 Jan 2018 05:29:10 +0000 (14:29 +0900)
Use common methods instead of using existing step.
Existing steps should not be affected by recovery mode as possible.

Change-Id: Idbc438f82be89d3f490b482aac0d8b97eea70b51
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/filesystem/step_recover_globalapp_symlinks.cc
src/common/step/filesystem/step_remove_globalapp_symlinks.cc

index 83cfb11..5b5b699 100644 (file)
@@ -3,7 +3,8 @@
 // found in the LICENSE file.
 
 #include "common/step/filesystem/step_recover_globalapp_symlinks.h"
-#include "common/step/filesystem/step_remove_globalapp_symlinks.h"
+
+#include "common/shared_dirs.h"
 
 namespace bf = boost::filesystem;
 
@@ -11,11 +12,11 @@ namespace common_installer {
 namespace filesystem {
 
 Step::Status StepRecoverGlobalAppSymlinks::RecoveryReadonlyUpdateInstall() {
-  StepRemoveGlobalAppSymlinks step(context_);
-  Status status = step.precheck();
-  if (status != Status::OK)
-      return status;
-  return step.process();
+  if (!DeleteGlobalAppSymlinksForAllUsers(context_->pkgid.get())) {
+    LOG(ERROR) << "Failed to delete globalapp symlinks";
+    return Status::GLOBALSYMLINK_ERROR;
+  }
+  return Status::OK;
 }
 
 }  // namespace filesystem
index 6ba6733..80c6fce 100644 (file)
@@ -23,8 +23,7 @@ namespace common_installer {
 namespace filesystem {
 
 Step::Status StepRemoveGlobalAppSymlinks::process() {
-  RequestType req_type = context_->request_type.get();
-  if (context_->is_readonly_package.get() && req_type != RequestType::Recovery)
+  if (context_->is_readonly_package.get())
     return Step::Status::OK;
 
   if (context_->request_mode.get() != RequestMode::GLOBAL)
@@ -36,9 +35,9 @@ Step::Status StepRemoveGlobalAppSymlinks::process() {
 
   std::string package_id = context_->pkgid.get();
 
+  RequestType req_type = context_->request_type.get();
   if (req_type == RequestType::Uninstall ||
-      req_type == RequestType::ReadonlyUpdateUninstall ||
-      req_type == RequestType::Recovery) {
+      req_type == RequestType::ReadonlyUpdateUninstall) {
     LOG(INFO) << "Deleting globalapp symlinks for all user, package: "
               << package_id;
     if (!DeleteGlobalAppSymlinksForAllUsers(package_id)) {