Fix installer behavior 48/91948/3 accepted/tizen/3.0/ivi/20161102.075730 accepted/tizen/3.0/mobile/20161102.075524 accepted/tizen/3.0/tv/20161102.075628 accepted/tizen/3.0/wearable/20161102.075701 accepted/tizen/common/20161031.121650 accepted/tizen/ivi/20161031.082310 accepted/tizen/mobile/20161031.082152 accepted/tizen/tv/20161031.082231 accepted/tizen/wearable/20161031.082251 submit/tizen/20161031.010650 submit/tizen_3.0/20161102.051512
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 12 Oct 2016 08:29:33 +0000 (17:29 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 31 Oct 2016 01:05:10 +0000 (18:05 -0700)
- Add routine which remove unnecessary file
- Change install location to internal when initialization
of external storage has failed, instead of install fail

Change-Id: Id4ae2ad3b06334770354fe991ab3531b451cd04f
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/step/backup/step_copy_backup.cc
src/common/step/backup/step_copy_backup.h
src/common/step/filesystem/step_acquire_external_storage.cc

index 7c1c606..58eaa1c 100644 (file)
@@ -54,6 +54,8 @@ Step::Status StepCopyBackup::process() {
   if (!NewContent())
     return Status::APP_DIR_ERROR;
 
+  RemoveContent();
+
   return Status::OK;
 }
 
@@ -159,6 +161,17 @@ bool StepCopyBackup::MoveMountPointContent(const boost::filesystem::path& from,
   return true;
 }
 
+void StepCopyBackup::RemoveContent() {
+  if (context_->request_type.get() == RequestType::Update &&
+    !context_->external_storage && bf::exists(install_path_ / ".mmc")) {
+    LOG(WARNING) << "Remove unnecessary files for external storage";
+    bs::error_code error;
+    bf::remove((install_path_ / ".mmc"), error);
+    if (error)
+      LOG(WARNING) << "error while remove files";
+  }
+}
+
 bool StepCopyBackup::NewContent() {
   bs::error_code error;
   bf::create_directories(install_path_.parent_path(), error);
index a4ed590..6a637ee 100644 (file)
@@ -55,6 +55,7 @@ class StepCopyBackup : public Step {
  private:
   bool Backup();
   bool NewContent();
+  void RemoveContent();
   bool CleanBackupDirectory();
   bool RollbackApplicationDirectory();
   bool MoveMountPointContent(const boost::filesystem::path& from,
index a90f7f6..659d568 100644 (file)
@@ -88,7 +88,7 @@ Step::Status StepAcquireExternalStorage::process() {
       storage = Storage::INTERNAL;
     } else {
       LOG(ERROR) << "Cannot initialize external storage for updated package";
-      return Status::APP_DIR_ERROR;
+      storage = Storage::INTERNAL;
     }
   }