which are related to mount or directories installer create.
this fix mount-install and external-install failure.
Change-Id: I435a6c8d781b2ddd90f83852ab46eb9fd1f35af7
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
SET(SRCS
+ tpk_mount_path.cc
step/configuration/step_parse_preload.cc
step/filesystem/step_check_pkg_directory_path.cc
step/filesystem/step_create_symbolic_link.cc
#include <common/utils/file_util.h>
+#include "tpk/tpk_mount_path.h"
+
namespace bf = boost::filesystem;
namespace bs = boost::system;
namespace ci = common_installer;
boost::make_iterator_range(bf::directory_iterator(app_root), {})) {
auto path = entry.path();
+ // skip path, which is related to mount or directory installer creates
+ if (bf::is_directory(path) &&
+ (path.filename() == ".mmc" || path.filename() == ".pkg" ||
+ path.filename() == "tep"))
+ continue;
+
+ // if mount-install, apply to extracted directories only
+ if (context_->request_type.get() == ci::RequestType::MountInstall ||
+ context_->request_type.get() == ci::RequestType::MountUpdate) {
+ bool skip = true;
+ for (auto& entry : tpk::GetExtractEntries()) {
+ if (bf::is_directory(path) && path.filename() == entry) {
+ skip = false;
+ break;
+ }
+ }
+ if (skip)
+ continue;
+ }
+
if (bf::is_directory(path) && path.filename() == "bin") {
auto permission = bf::perms::owner_all |
bf::perms::group_read | bf::perms::group_exe |
// Use of this source code is governed by an apache-2.0 license that can be
// found in the LICENSE file.
-
-#ifndef TPK_STEP_FILESYSTEM_TPK_GRANT_PERMISSION_H_
-#define TPK_STEP_FILESYSTEM_TPK_GRANT_PERMISSION_H_
+#ifndef TPK_STEP_FILESYSTEM_STEP_GRANT_PERMISSION_H_
+#define TPK_STEP_FILESYSTEM_STEP_GRANT_PERMISSION_H_
#include <manifest_parser/utils/logging.h>
} // namespace filesystem
} // namespace tpk
-#endif // TPK_STEP_FILESYSTEM_TPK_GRANT_PERMISSION_H_
+#endif // TPK_STEP_FILESYSTEM_STEP_GRANT_PERMISSION_H_
#include <common/backup_paths.h>
#include <common/utils/file_util.h>
+#include "tpk/tpk_mount_path.h"
+
namespace bf = boost::filesystem;
namespace bs = boost::system;
namespace ci = common_installer;
-namespace {
-
-const std::vector<std::string> kExtractEntries = {
- "bin",
- "lib",
- "shared/res"
-};
-
-const std::vector<std::string> kSymlinkEntries = {
- "res",
- "tizen-manifest.xml",
- "author-signature.xml",
- "signature1.xml",
- "signature2.xml"
-};
-
-} // namespace
-
namespace tpk {
namespace filesystem {
ci::Step::Status StepTpkPreparePackageDirectory::ExtractEntries() {
LOG(DEBUG) << "Extracting entries from zip package...";
- for (auto& entry : GetExtractEntries()) {
+ for (auto& entry : tpk::GetExtractEntries()) {
LOG(DEBUG) << "Extracting: " << entry;
auto status = PrepareDirectory(entry);
if (status != Status::OK)
ci::Step::Status StepTpkPreparePackageDirectory::PrepareLinks() {
bf::path mount_point = ci::GetMountLocation(context_->pkg_path.get());
LOG(DEBUG) << "Creating symlinks to zip package...";
- for (auto& link_entry : kSymlinkEntries) {
+ for (auto& link_entry : tpk::GetSymlinkEntries()) {
LOG(DEBUG) << "Symlink: " << link_entry;
auto status = PrepareLink(link_entry, mount_point);
if (status != Status::OK)
return Status::OK;
}
-const std::vector<std::string>&
-StepTpkPreparePackageDirectory::GetExtractEntries() const {
- return kExtractEntries;
-}
-
} // namespace filesystem
} // namespace tpk
Status ExtractEntries();
Status PrepareLink(const std::string& entry,
const boost::filesystem::path& mount_point);
- const std::vector<std::string>& GetExtractEntries() const;
SCOPE_LOG_TAG(TpkPreparePackageDirectory)
};
#include <vector>
+#include "tpk/tpk_mount_path.h"
+
namespace bf = boost::filesystem;
namespace bs = boost::system;
namespace ci = common_installer;
ci::Step::Status StepTpkUpdatePackageDirectory::BackupEntries() {
bf::path backup_path =
ci::GetBackupPathForPackagePath(context_->pkg_path.get());
- for (auto& entry : GetExtractEntries()) {
+ for (auto& entry : tpk::GetExtractEntries()) {
auto status = BackupDirectory(entry, backup_path);
if (status != Status::OK)
return status;
bf::path backup_path =
ci::GetBackupPathForPackagePath(context_->pkg_path.get());
- for (auto& entry : GetExtractEntries()) {
+ for (auto& entry : tpk::GetExtractEntries()) {
auto status = RestoreDirectory(entry, backup_path);
if (status != Status::OK)
return status;
} // namespace rds
} // namespace tpk
-#endif // TPK_STEP_RDS_STEP_TPK_RDS_MODIFY_H_
+#endif // TPK_STEP_RDS_STEP_TPK_RDS_MODIFY_H_
--- /dev/null
+// Copyright (c) 2016 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 "tpk/tpk_mount_path.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+
+namespace {
+
+const std::vector<std::string> kExtractEntries = {
+ "bin",
+ "lib",
+ "shared/res"
+};
+
+const std::vector<std::string> kSymlinkEntries = {
+ "res",
+ "tizen-manifest.xml",
+ "author-signature.xml",
+ "signature1.xml",
+ "signature2.xml"
+};
+
+} // namespace
+
+namespace tpk {
+
+const std::vector<std::string>& GetExtractEntries() {
+ return kExtractEntries;
+}
+
+const std::vector<std::string>& GetSymlinkEntries() {
+ return kSymlinkEntries;
+}
+
+} // namespace tpk
--- /dev/null
+// Copyright (c) 2016 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 TPK_TPK_MOUNT_PATH_H_
+#define TPK_TPK_MOUNT_PATH_H_
+
+#include <string>
+#include <vector>
+
+namespace tpk {
+
+const std::vector<std::string>& GetExtractEntries();
+const std::vector<std::string>& GetSymlinkEntries();
+
+} // namespace tpk
+
+#endif // TPK_TPK_MOUNT_PATH_H_