From f0798bd72913cc3f2e7837aca38bf3ac14e6d631 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Wed, 3 Aug 2016 13:57:59 +0200 Subject: [PATCH] Fix preload request for wgt This commit should allow to install preload wgt package with command: - wgt-backend --preload -i $package Submit together: - https://review.tizen.org/gerrit/82424 - https://review.tizen.org/gerrit/82496 - https://review.tizen.org/gerrit/82497 Change-Id: Ic0926ebb16e725e1c1304394acfac559c57aa95c --- src/tpk/CMakeLists.txt | 1 - src/tpk/step/configuration/step_parse_preload.cc | 49 ------------------------ src/tpk/step/configuration/step_parse_preload.h | 31 --------------- src/tpk/tpk_installer.cc | 16 ++++---- 4 files changed, 8 insertions(+), 89 deletions(-) delete mode 100644 src/tpk/step/configuration/step_parse_preload.cc delete mode 100644 src/tpk/step/configuration/step_parse_preload.h diff --git a/src/tpk/CMakeLists.txt b/src/tpk/CMakeLists.txt index 0a8181d..03d4e34 100644 --- a/src/tpk/CMakeLists.txt +++ b/src/tpk/CMakeLists.txt @@ -1,6 +1,5 @@ SET(SRCS external_dirs.cc - step/configuration/step_parse_preload.cc step/filesystem/step_check_pkg_directory_path.cc step/filesystem/step_create_external_storage_directories.cc step/filesystem/step_create_symbolic_link.cc diff --git a/src/tpk/step/configuration/step_parse_preload.cc b/src/tpk/step/configuration/step_parse_preload.cc deleted file mode 100644 index 0d572ee..0000000 --- a/src/tpk/step/configuration/step_parse_preload.cc +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by a apache 2.0 license that can be -// found in the LICENSE file. - -#include "tpk/step/configuration/step_parse_preload.h" - -#include -#include - -#include - -#include -#include -#include - -#include "common/pkgmgr_interface.h" -#include "common/utils/file_util.h" - -namespace bf = boost::filesystem; -namespace ci = common_installer; - -namespace tpk { -namespace configuration { - -ci::Step::Status StepParsePreload::process() { - const char* preload_manifest_val = context_->manifest_data.get()->preload; - - if (strcmp(preload_manifest_val, "true") != 0) { - bool is_preload = context_->is_preload_request.get(); - - LOG(INFO) << "is_preload : (" << is_preload << ")"; - if (is_preload) { - context_->manifest_data.get()->preload = strdup("true"); - - if (getuid() != 0) { - LOG(ERROR) << "You're not authorized to install preload app: " - << context_->pkgid.get().c_str(); - return Status::OPERATION_NOT_ALLOWED; - } - } else { - context_->manifest_data.get()->preload = strdup("false"); - } - } - - return Status::OK; -} - -} // namespace configuration -} // namespace tpk diff --git a/src/tpk/step/configuration/step_parse_preload.h b/src/tpk/step/configuration/step_parse_preload.h deleted file mode 100644 index 51fe4a3..0000000 --- a/src/tpk/step/configuration/step_parse_preload.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by a apache 2.0 license that can be -// found in the LICENSE file. - -#ifndef TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_ -#define TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_ - -#include - -#include "common/installer_context.h" -#include "common/step/step.h" - -namespace tpk { -namespace configuration { - -class StepParsePreload : 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; } - - STEP_NAME(ParsePreload) -}; - -} // namespace configuration -} // namespace tpk - -#endif // TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_ diff --git a/src/tpk/tpk_installer.cc b/src/tpk/tpk_installer.cc index aa5f78b..f479553 100644 --- a/src/tpk/tpk_installer.cc +++ b/src/tpk/tpk_installer.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ #include #include -#include "tpk/step/configuration/step_parse_preload.h" #include "tpk/step/filesystem/step_create_external_storage_directories.h" #include "tpk/step/filesystem/step_create_symbolic_link.h" #include "tpk/step/filesystem/step_check_pkg_directory_path.h" @@ -151,7 +151,7 @@ void TpkInstaller::InstallSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -183,7 +183,7 @@ void TpkInstaller::UpdateSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -241,7 +241,7 @@ void TpkInstaller::ReinstallSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); // TODO(t.iwanek): add StepCheckSignature which is missing @@ -340,7 +340,7 @@ void TpkInstaller::MountInstallSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -372,7 +372,7 @@ void TpkInstaller::MountUpdateSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -406,7 +406,7 @@ void TpkInstaller::ManifestDirectInstallSteps() { ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::NORMAL); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -428,7 +428,7 @@ void TpkInstaller::ManifestDirectUpdateSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); -- 2.7.4