SET(SRCS
step/step_check_tpk_background_category.cc
step/step_create_symbolic_link.cc
+ step/step_parse_preload.cc
step/step_convert_xml.cc
step/step_tpk_patch_icons.cc
tpk_app_query_interface.cc
--- /dev/null
+// 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/step_parse_preload.h"
+
+#include <pkgmgr-info.h>
+#include <unistd.h>
+
+#include <boost/filesystem.hpp>
+
+#include <cstring>
+#include <cstdio>
+#include <string>
+
+#include "common/pkgmgr_interface.h"
+#include "common/utils/file_util.h"
+
+namespace {
+const char kPathManifestPrefix[] = "/usr/share/packages";
+}
+
+namespace common_installer {
+namespace tpk {
+
+namespace bf = boost::filesystem;
+
+Step::Status StepParsePreload::process() {
+ const char* preload_manifest_val = context_->manifest_data.get()->preload;
+
+ bool is_preload = false;
+
+ if (context_->installation_mode.get() == InstallationMode::OFFLINE) {
+ if (strcmp(preload_manifest_val, "false") != 0) {
+ is_preload = true;
+ }
+ } else {
+ if (context_->request_type.get() == RequestType::ManifestDirectInstall ||
+ context_->request_type.get() == RequestType::ManifestDirectUpdate) {
+ if (strcmp(preload_manifest_val, "true") == 0) {
+ is_preload = true;
+ }
+ }
+ }
+
+ if (is_preload) {
+ context_->manifest_data.get()->preload = strdup("true");
+
+ 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 tpk
+} // namespace common_installer
--- /dev/null
+// 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 COMMON_STEP_STEP_PARSE_PRELOAD_H_
+#define COMMON_STEP_STEP_PARSE_PRELOAD_H_
+
+#include <manifest_parser/utils/logging.h>
+
+#include "common/installer_context.h"
+#include "common/step/step.h"
+
+namespace common_installer {
+namespace tpk {
+
+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; }
+
+ SCOPE_LOG_TAG(ParsePreload)
+};
+
+} // namespace tpk
+} // namespace common_installer
+
+#endif // COMMON_STEP_STEP_PARSE_PRELOAD_H_
LOG(ERROR) << "Failed to create pkgmgr interface";
return -1;
}
+
tpk::TpkInstaller t(pkgmgr);
if (t.Run() != ci::AppInstaller::Result::OK) {
LOG(ERROR) << "TpkInstaller run failure";
#include <common/step/step_update_tep.h>
#include "tpk/step/step_check_tpk_background_category.h"
#include "tpk/step/step_create_symbolic_link.h"
+#include "tpk/step/step_parse_preload.h"
#include "tpk/step/step_convert_xml.h"
#include "tpk/step/step_tpk_patch_icons.h"
AddStep<ci::parse::StepParseManifest>(
ci::parse::StepParseManifest::ManifestLocation::PACKAGE,
ci::parse::StepParseManifest::StoreLocation::NORMAL);
+ AddStep<ci::tpk::StepParsePreload>();
AddStep<ci::security::StepCheckSignature>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
AddStep<ci::parse::StepParseManifest>(
ci::parse::StepParseManifest::ManifestLocation::PACKAGE,
ci::parse::StepParseManifest::StoreLocation::NORMAL);
+ AddStep<ci::tpk::StepParsePreload>();
AddStep<ci::security::StepCheckSignature>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
AddStep<ci::parse::StepParseManifest>(
ci::parse::StepParseManifest::ManifestLocation::INSTALLED,
ci::parse::StepParseManifest::StoreLocation::NORMAL);
+ AddStep<ci::tpk::StepParsePreload>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
AddStep<ci::security::StepRollbackInstallationSecurity>();
AddStep<ci::parse::StepParseManifest>(
ci::parse::StepParseManifest::ManifestLocation::INSTALLED,
ci::parse::StepParseManifest::StoreLocation::NORMAL);
+ AddStep<ci::tpk::StepParsePreload>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
AddStep<ci::pkgmgr::StepKillApps>();