Clean up of storage dirs code - fix update in hybrid app installation 44/57044/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 14 Jan 2016 14:14:57 +0000 (15:14 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Thu, 14 Jan 2016 15:53:40 +0000 (16:53 +0100)
Fixes some issue in code handling storage directories.

Due to requirement of copying wgt's shared/ directory is addition,
situation where:

 - common create storage directories step - create directories for tpk
 - wgt create storage directories step - create directories for wgt

should be changed to:

 - common create storage directories step - create directories for tpk and wgt
 - wgt create storage directories step - only patches shared/ directory with
                                         widget shared/ before common step

Change-Id: I10f94eafbe31497ad5216f1f5e1ce1abf81bbd44

src/hybrid/hybrid_installer.cc
src/wgt/CMakeLists.txt
src/wgt/step/step_wgt_copy_storage_directories.cc [deleted file]
src/wgt/step/step_wgt_copy_storage_directories.h [deleted file]
src/wgt/step/step_wgt_create_storage_directories.cc [deleted file]
src/wgt/step/step_wgt_create_storage_directories.h [deleted file]
src/wgt/step/step_wgt_patch_storage_directories.cc [new file with mode: 0644]
src/wgt/step/step_wgt_patch_storage_directories.h [new file with mode: 0644]
src/wgt/wgt_installer.cc

index 7e75a28..c8ec5ad 100644 (file)
@@ -10,7 +10,9 @@
 #include <common/step/step_configure.h>
 #include <common/step/step_copy.h>
 #include <common/step/step_copy_backup.h>
+#include <common/step/step_copy_storage_directories.h>
 #include <common/step/step_create_icons.h>
+#include <common/step/step_create_storage_directories.h>
 #include <common/step/step_delta_patch.h>
 #include <common/step/step_fail.h>
 #include <common/step/step_kill_apps.h>
@@ -43,8 +45,7 @@
 #include "wgt/step/step_generate_xml.h"
 #include "wgt/step/step_remove_encryption_data.h"
 #include "wgt/step/step_wgt_create_icons.h"
-#include "wgt/step/step_wgt_create_storage_directories.h"
-#include "wgt/step/step_wgt_copy_storage_directories.h"
+#include "wgt/step/step_wgt_patch_storage_directories.h"
 
 namespace ci = common_installer;
 
@@ -69,11 +70,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<hybrid::encrypt::StepEncryptResources>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
       AddStep<ci::filesystem::StepCopy>();
-      AddStep<wgt::filesystem::StepWgtCreateStorageDirectories>();
-      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<ci::filesystem::StepCreateIcons>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCreateStorageDirectories>();
+      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
       AddStep<ci::security::StepRegisterSecurity>();
@@ -96,11 +98,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
       AddStep<ci::backup::StepCopyBackup>();
-      AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
-      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<ci::filesystem::StepCreateIcons>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCopyStorageDirectories>();
+      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
@@ -145,11 +148,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
       AddStep<ci::backup::StepCopyBackup>();
-      AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
-      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<ci::filesystem::StepCreateIcons>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCopyStorageDirectories>();
+      AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+      AddStep<tpk::filesystem::StepCreateSymbolicLink>();
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
index a1ee89c..7f32240 100644 (file)
@@ -13,8 +13,7 @@ SET(SRCS
   step/step_rds_modify.cc
   step/step_wgt_backup_icons.cc
   step/step_wgt_create_icons.cc
-  step/step_wgt_create_storage_directories.cc
-  step/step_wgt_copy_storage_directories.cc
+  step/step_wgt_patch_storage_directories.cc
   step/step_wgt_recover_icons.cc
   step/step_wgt_resource_directory.cc
   step/step_add_default_privileges.cc
diff --git a/src/wgt/step/step_wgt_copy_storage_directories.cc b/src/wgt/step/step_wgt_copy_storage_directories.cc
deleted file mode 100644 (file)
index fc2e366..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#include "wgt/step/step_wgt_copy_storage_directories.h"
-
-#include <boost/system/error_code.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
-#include <common/utils/file_util.h>
-
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
-
-namespace {
-
-const char kDataLocation[] = "data";
-const char kSharedLocation[] = "shared";
-const char kSharedDataLocation[] = "shared/data";
-const char kSharedTrustedLocation[] = "shared/trusted";
-const char kResWgtSubPath[] = "res/wgt";
-const char kTemporaryData[] = "tmp";
-}  // namespace
-
-namespace wgt {
-namespace filesystem {
-
-common_installer::Step::Status StepWgtCopyStorageDirectories::process() {
-  Status status = CreatePrivateTmpDir();
-  if (status != Status::OK)
-    return status;
-  if (!CacheDir())
-    return Status::APP_DIR_ERROR;
-
-  int version = context_->manifest_data.get()->api_version[0] - '0';
-  if (version < 3) {
-    LOG(DEBUG) << "Shared directory coping for tizen 2.x";
-    return StepCopyStorageDirectories::process();
-  }
-
-  LOG(DEBUG) << "Shared directory coping for tizen 3.x";
-  status = CopySharedDirectory();
-  if (status != Status::OK)
-    return status;
-
-  return CopyDataDirectory();
-}
-
-common_installer::Step::Status StepWgtCopyStorageDirectories::undo() {
-  int version = context_->manifest_data.get()->api_version[0] - '0';
-  if (version < 3) {
-    LOG(DEBUG) << "Shared directory coping for tizen 2.x";
-    return StepCopyStorageDirectories::undo();
-  }
-
-  UndoSharedDirectory();
-  UndoDataDirectory();
-  return Status::OK;
-}
-
-void StepWgtCopyStorageDirectories::UndoSharedDirectory() {
-  if (!MoveAppStorage(context_->pkg_path.get(),
-                      backup_path_,
-                      kSharedDataLocation)) {
-    LOG(ERROR) <<
-        "Failed to undo moving of shared/data directory for widget in update";
-  }
-
-  if (!MoveAppStorage(context_->pkg_path.get(),
-                      backup_path_,
-                      kSharedTrustedLocation)) {
-    LOG(ERROR) << "Failed to undo moving of shared/trusted directory"
-               << "for widget in update";
-  }
-}
-
-void StepWgtCopyStorageDirectories::UndoDataDirectory() {
-  if (!MoveAppStorage(context_->pkg_path.get(),
-                      backup_path_,
-                      kDataLocation)) {
-    LOG(ERROR)
-        << "Failed to undo moving of private directory for widget in update";
-  }
-}
-
-common_installer::Step::Status
-StepWgtCopyStorageDirectories::HandleWgtSharedDirectory() {
-  bf::path res_wgt_path = context_->pkg_path.get() / kResWgtSubPath;
-  bf::path shared_source = res_wgt_path / kSharedLocation;
-  bf::path shared_destination = context_->pkg_path.get() / kSharedLocation;
-
-  // Move shared if exist in wgt
-  if (bf::exists(shared_source)) {
-    if (!common_installer::MoveDir(shared_source, shared_destination)) {
-      LOG(ERROR) << "Failed to move shared data from res/wgt to shared";
-      return Status::ERROR;
-    }
-  }
-
-  // Create shared directory if not present yet
-  if (!bf::exists(shared_destination)) {
-    bs::error_code error_code;
-    bf::create_directory(shared_destination, error_code);
-    if (error_code) {
-      LOG(ERROR) << "Failed to create shared storage directory";
-      return Status::ERROR;
-    }
-  }
-
-  // Symlink created shared directory
-  bs::error_code error_code;
-  bf::create_symlink(shared_destination, shared_source, error_code);
-  if (error_code) {
-    LOG(ERROR) << "Failed to create symbolic link for shared dir"
-               << boost::system::system_error(error_code).what();
-    return Status::ERROR;
-  }
-  return Status::OK;
-}
-
-common_installer::Step::Status
-StepWgtCopyStorageDirectories::CopySharedDirectory() {
-  Status status = HandleWgtSharedDirectory();
-  if (status != Status::OK)
-    return status;
-
-  if (!MoveAppStorage(backup_path_,
-                      context_->pkg_path.get(),
-                      kSharedDataLocation)) {
-    LOG(ERROR) <<
-        "Failed to restore shared/data directory for widget in update";
-    return Status::ERROR;
-  }
-
-  if (!MoveAppStorage(backup_path_,
-                      context_->pkg_path.get(),
-                      kSharedTrustedLocation)) {
-    LOG(ERROR) <<
-        "Failed to restore shared/trusted directory for widget in update";
-    return Status::ERROR;
-  }
-
-  return Status::OK;
-}
-
-common_installer::Step::Status
-StepWgtCopyStorageDirectories::CopyDataDirectory() {
-  if (!MoveAppStorage(backup_path_,
-                      context_->pkg_path.get(),
-                      kDataLocation)) {
-    LOG(ERROR) << "Failed to restore private directory for widget in update";
-    return Status::ERROR;
-  }
-  return Status::OK;
-}
-
-common_installer::Step::Status
-StepWgtCopyStorageDirectories::CreatePrivateTmpDir() {
-  bs::error_code error_code;
-  bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
-  bf::create_directory(tmp_path, error_code);
-  if (error_code) {
-    LOG(ERROR) << "Failed to create private temporary directory for package";
-    return Status::ERROR;
-  }
-  return Status::OK;
-}
-
-}  // namespace filesystem
-}  // namespace wgt
-
diff --git a/src/wgt/step/step_wgt_copy_storage_directories.h b/src/wgt/step/step_wgt_copy_storage_directories.h
deleted file mode 100644 (file)
index 18eac47..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef WGT_STEP_STEP_WGT_COPY_STORAGE_DIRECTORIES_H_
-#define WGT_STEP_STEP_WGT_COPY_STORAGE_DIRECTORIES_H_
-
-#include <manifest_parser/utils/logging.h>
-
-#include <common/step/step_copy_storage_directories.h>
-
-namespace wgt {
-namespace filesystem {
-
-/**
- * \brief Update installation (WGT).
- *        Responsible for coping shared and data directories.
- *        It extends StepCopyStorageDirectories (it adds distinction between
- *        2.x and 3.x shared dir handling
- */
-class StepWgtCopyStorageDirectories
-    : public common_installer::filesystem::StepCopyStorageDirectories {
- public:
-  using StepCopyStorageDirectories::StepCopyStorageDirectories;
-
-  /**
-   * \brief Create shared and private directories,
-   *        and copy/restore widget files to appropriate directory
-   *
-   * \return Status::ERROR when failed to create temporary location,
-   *                       private temporary location, or failed to restore
-   *                       shared/private directory for widget,
-   *         Status::OK otherwise
-   */
-  Status process() override;
-
-  /**
-   * \brief Move files from shared/private directories back to source directory
-   *
-   * \return Status::OK
-   */
-  Status undo() override;
-
- private:
-  Status CopySharedDirectory();
-  Status CopyDataDirectory();
-  Status HandleWgtSharedDirectory();
-  void UndoSharedDirectory();
-  void UndoDataDirectory();
-  Status CreatePrivateTmpDir();
-
-  SCOPE_LOG_TAG(CopyWgtStorageDirectories)
-};
-
-}  // namespace filesystem
-}  // namespace wgt
-
-#endif  // WGT_STEP_STEP_WGT_COPY_STORAGE_DIRECTORIES_H_
diff --git a/src/wgt/step/step_wgt_create_storage_directories.cc b/src/wgt/step/step_wgt_create_storage_directories.cc
deleted file mode 100644 (file)
index d50d072..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include "wgt/step/step_wgt_create_storage_directories.h"
-
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
-#include <common/utils/file_util.h>
-
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
-
-namespace {
-
-const char kSharedLocation[] = "shared";
-const char kResWgtSubPath[] = "res/wgt";
-const char kTemporaryData[] = "tmp";
-
-}  // namespace
-
-namespace wgt {
-namespace filesystem {
-
-common_installer::Step::Status StepWgtCreateStorageDirectories::process() {
-  if (!PrivateDir())
-    return Status::APP_DIR_ERROR;
-
-  char version = context_->manifest_data.get()->api_version[0];
-
-  if ((version-'0') < 3) {
-    LOG(DEBUG) << "Shared directory preparation for tizen 2.x";
-    if (!ShareDir())
-      return Status::APP_DIR_ERROR;
-  } else {
-    LOG(DEBUG) << "Shared directory preparation for tizen 3.x";
-    if (!ShareDirFor3x())
-      return Status::APP_DIR_ERROR;
-  }
-
-  if (!SubShareDir())
-    return Status::APP_DIR_ERROR;
-
-  if (!CreatePrivateTmpDir())
-    return Status::APP_DIR_ERROR;
-
-  if (!CacheDir())
-    return Status::APP_DIR_ERROR;
-
-  return Status::OK;
-}
-
-bool StepWgtCreateStorageDirectories::ShareDirFor2x() {
-  bs::error_code error_code;
-  bf::path shared_path = context_->pkg_path.get() / kSharedLocation;
-  bf::create_directory(shared_path, error_code);
-  if (error_code) {
-    LOG(ERROR) << "Failed to create shared directory for widget";
-    return false;
-  }
-  return true;
-}
-
-bool StepWgtCreateStorageDirectories::ShareDirFor3x() {
-  bf::path res_wgt_path = context_->pkg_path.get() / kResWgtSubPath;
-  if (!bf::exists(res_wgt_path / kSharedLocation)) {
-    if (!ShareDir())
-      return false;
-  } else {
-    bf::path src = res_wgt_path / kSharedLocation;
-    bf::path dst = context_->pkg_path.get() / kSharedLocation;
-    if (!common_installer::MoveDir(src, dst)) {
-      LOG(ERROR) << "Failed to move shared data from res/wgt to shared";
-      return false;
-    }
-
-    bs::error_code error_code;
-    bf::create_symlink(dst, src, error_code);
-    if (error_code) {
-      LOG(ERROR) << "Failed to create symbolic link for shared dir"
-        << boost::system::system_error(error_code).what();
-      return false;
-    }
-  }  // else
-  return true;
-}
-
-bool StepWgtCreateStorageDirectories::CreatePrivateTmpDir() {
-  bs::error_code error_code;
-  bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
-  bf::create_directory(tmp_path, error_code);
-  if (error_code) {
-    LOG(ERROR) << "Failed to create private temporary directory for package";
-    return false;
-  }
-  return true;
-}
-
-}  // namespace filesystem
-}  // namespace wgt
diff --git a/src/wgt/step/step_wgt_create_storage_directories.h b/src/wgt/step/step_wgt_create_storage_directories.h
deleted file mode 100644 (file)
index 789c5ee..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache 2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef WGT_STEP_STEP_WGT_CREATE_STORAGE_DIRECTORIES_H_
-#define WGT_STEP_STEP_WGT_CREATE_STORAGE_DIRECTORIES_H_
-
-#include <manifest_parser/utils/logging.h>
-
-#include <common/step/step_create_storage_directories.h>
-
-namespace wgt {
-namespace filesystem {
-
-/**
- * \brief Installation (WGT).
- *        Responsible for creating shared and data directories.
- *        It extends StepCreateStorageDirectories (it adds distinction between
- *        2.x and 3.x shared dir handling
- *
- * process method implements creation of shared and data directories.
- * Depending on tizen required version it can also move "shared" resources
- * from ./res/wgt/shared to ./shared dir (and create symlink back
- * to ./res/wgt/shared).
- *
- * StepWgtCreateStorageDirectories works on following directory:
- * * TZ_SYS_RW/PKGID (/usr/apps/PKGID)
- * * TZ_SER_APPS/PKGID  (/{HOME}/apps_rw/PKGID)
- */
-class StepWgtCreateStorageDirectories :
-    public common_installer::filesystem::StepCreateStorageDirectories {
- public:
-  using StepCreateStorageDirectories::StepCreateStorageDirectories;
-
-  /**
-   * \brief Create shared and private directories
-   *
-   * \return Status::ERROR when failed to create temporary location, or
-   *                       private temporary location
-   *         Status::OK otherwise
-   */
-  Status process() override;
-
-  /**
-   * \brief Empty method
-   *
-   * \return Status::OK
-   */
-  Status clean() override { return Status::OK; }
-
-  /**
-   * \brief Empty method
-   *
-   * \return Status::OK
-   */
-  Status undo() override { return Status::OK; }
-
-  /**
-   * \brief Empty method
-   *
-   * \return Status::OK
-   */
-  Status precheck() override { return Status::OK; }
-
- private:
-  bool ShareDirFor2x();
-  bool ShareDirFor3x();
-
-  bool CreatePrivateTmpDir();
-
-  SCOPE_LOG_TAG(CreateWgtStorageDirectories)
-};
-
-}  // namespace filesystem
-}  // namespace wgt
-
-#endif  // WGT_STEP_STEP_WGT_CREATE_STORAGE_DIRECTORIES_H_
diff --git a/src/wgt/step/step_wgt_patch_storage_directories.cc b/src/wgt/step/step_wgt_patch_storage_directories.cc
new file mode 100644 (file)
index 0000000..c6a7a94
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/step/step_wgt_patch_storage_directories.h"
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <common/utils/file_util.h>
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+
+namespace {
+
+const char kSharedLocation[] = "shared";
+const char kResWgtSubPath[] = "res/wgt";
+const char kTemporaryData[] = "tmp";
+
+}  // namespace
+
+namespace wgt {
+namespace filesystem {
+
+common_installer::Step::Status StepWgtPatchStorageDirectories::process() {
+  if (!CreatePrivateTmpDir())
+    return Status::APP_DIR_ERROR;
+
+  char version = context_->manifest_data.get()->api_version[0];
+  if ((version-'0') >= 3) {
+    LOG(DEBUG) << "Copying widget's shared/ directory";
+    if (!ShareDirFor3x())
+      return Status::APP_DIR_ERROR;
+  }
+
+  return Status::OK;
+}
+
+bool StepWgtPatchStorageDirectories::ShareDirFor3x() {
+  bf::path src = context_->pkg_path.get() / kResWgtSubPath / kSharedLocation;
+  bf::path dst = context_->pkg_path.get() / kSharedLocation;
+  if (!common_installer::MoveDir(src, dst,
+                                 common_installer::FS_MERGE_DIRECTORIES)) {
+    LOG(ERROR) << "Failed to move shared data from res/wgt to shared";
+    return false;
+  }
+
+  bs::error_code error_code;
+  bf::create_symlink(dst, src, error_code);
+  if (error_code) {
+    LOG(ERROR) << "Failed to create symbolic link for shared dir"
+               << boost::system::system_error(error_code).what();
+    return false;
+  }
+  return true;
+}
+
+bool StepWgtPatchStorageDirectories::CreatePrivateTmpDir() {
+  bs::error_code error_code;
+  bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
+  bf::create_directory(tmp_path, error_code);
+  if (error_code) {
+    LOG(ERROR) << "Failed to create private temporary directory for package";
+    return false;
+  }
+  return true;
+}
+
+}  // namespace filesystem
+}  // namespace wgt
diff --git a/src/wgt/step/step_wgt_patch_storage_directories.h b/src/wgt/step/step_wgt_patch_storage_directories.h
new file mode 100644 (file)
index 0000000..89992df
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef WGT_STEP_STEP_WGT_PATCH_STORAGE_DIRECTORIES_H_
+#define WGT_STEP_STEP_WGT_PATCH_STORAGE_DIRECTORIES_H_
+
+#include <common/step/step.h>
+#include <manifest_parser/utils/logging.h>
+
+namespace wgt {
+namespace filesystem {
+
+/**
+ * \brief Installation (WGT).
+ *        Responsible for copying widgets shared/ directory into package's
+ *        shared/ directory for tizen widget with api version > 3.0
+ */
+class StepWgtPatchStorageDirectories :
+    public common_installer::Step {
+ public:
+  using Step::Step;
+
+  Status process() override;
+  Status clean() override { return Status::OK; }
+  Status undo() override { return Status::OK; }
+  Status precheck() override { return Status::OK; }
+
+ private:
+  bool ShareDirFor3x();
+  bool CreatePrivateTmpDir();
+
+  SCOPE_LOG_TAG(PatchWgtStorageDirectories)
+};
+
+}  // namespace filesystem
+}  // namespace wgt
+
+#endif  // WGT_STEP_STEP_WGT_PATCH_STORAGE_DIRECTORIES_H_
index 6f117b3..54e4bf0 100644 (file)
@@ -9,6 +9,7 @@
 #include <common/pkgmgr_interface.h>
 #include <common/step/step_configure.h>
 #include <common/step/step_backup_manifest.h>
+#include <common/step/step_create_storage_directories.h>
 #include <common/step/step_copy.h>
 #include <common/step/step_copy_backup.h>
 #include <common/step/step_copy_storage_directories.h>
@@ -51,9 +52,8 @@
 #include "wgt/step/step_rds_parse.h"
 #include "wgt/step/step_remove_encryption_data.h"
 #include "wgt/step/step_wgt_backup_icons.h"
-#include "wgt/step/step_wgt_copy_storage_directories.h"
 #include "wgt/step/step_wgt_create_icons.h"
-#include "wgt/step/step_wgt_create_storage_directories.h"
+#include "wgt/step/step_wgt_patch_storage_directories.h"
 #include "wgt/step/step_wgt_recover_icons.h"
 #include "wgt/step/step_wgt_resource_directory.h"
 
@@ -79,7 +79,8 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::filesystem::StepWgtResourceDirectory>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
       AddStep<ci::filesystem::StepCopy>();
-      AddStep<wgt::filesystem::StepWgtCreateStorageDirectories>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCreateStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
@@ -102,7 +103,8 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<wgt::backup::StepWgtBackupIcons>();
       AddStep<ci::backup::StepCopyBackup>();
-      AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCopyStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
       AddStep<ci::security::StepUpdateSecurity>();
@@ -151,7 +153,8 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<wgt::backup::StepWgtBackupIcons>();
       AddStep<ci::backup::StepCopyBackup>();
-      AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
+      AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
+      AddStep<ci::filesystem::StepCopyStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtCreateIcons>();
       AddStep<ci::security::StepUpdateSecurity>();