namespace app_keys = wgt::application_widget_keys;
namespace manifest_keys = wgt::application_manifest_keys;
+StepParse::StepParse(common_installer::ContextInstaller* context,
+ bool check_start_file)
+ : Step(context),
+ check_start_file_(check_start_file) {
+}
+
std::set<std::string> StepParse::ExtractPrivileges(
std::shared_ptr<const PermissionsInfo> perm_info) const {
return perm_info->GetAPIPermissions();
LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();
return common_installer::Step::Status::ERROR;
}
+ if (check_start_file_) {
+ if (!parser_->HasValidStartFile()) {
+ LOG(ERROR) << "No valid start file" << parser_->GetErrorMessage();
+ return common_installer::Step::Status::ERROR;
+ }
+ }
const manifest_x* manifest = context_->manifest_data.get();
if (!FillManifestX(const_cast<manifest_x*>(manifest))) {
class StepParse : public common_installer::Step {
public:
- using Step::Step;
+ explicit StepParse(common_installer::ContextInstaller* context,
+ bool check_start_file);
Status process() override;
Status clean() override { return Status::OK; }
bool FillManifestX(manifest_x* manifest);
std::unique_ptr<wgt::parse::WidgetConfigParser> parser_;
+ bool check_start_file_;
SCOPE_LOG_TAG(Parse)
};
namespace wgt {
namespace parse {
+StepParseRecovery::StepParseRecovery(
+ common_installer::ContextInstaller* context)
+ : StepParse(context, false) {
+}
+
common_installer::Step::Status StepParseRecovery::process() {
(void) StepParse::process();
return Status::OK;
*/
class StepParseRecovery : public StepParse {
public:
- using StepParse::StepParse;
+ StepParseRecovery(common_installer::ContextInstaller* context);
Status process() override;
Status precheck() override;
if (backup_temp_dir_.empty())
return false;
if (operation == Operation::DELETE || operation == Operation::MODIFY) {
- bf::path app_path = context_->pkg_path.get() /
- context_->manifest_data.get()->mainapp_id;;
+ bf::path app_path = context_->pkg_path.get() / "res" / "wgt";
bf::path source_path = app_path / relative_path;
if (bf::is_directory(source_path)) {
if (!cu::CreateDir(backup_temp_dir_ / relative_path)) {
}
bf::copy_file(source_path, tmp_dest_path, error);
if (error) {
- LOG(ERROR) << "unable to backup file " << error.message();
+ LOG(ERROR) << "unable to backup file: "
+ << source_path << " : " << error.message();
return false;
}
}
#include "wgt/wgt_installer.h"
+#include <manifest_handlers/widget_config_parser.h>
+
#include "common/pkgmgr_interface.h"
#include "common/step/step_configure.h"
#include "common/step/step_backup_manifest.h"
case ci::RequestType::Install : {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
- AddStep<wgt::parse::StepParse>();
+ AddStep<wgt::parse::StepParse>(true);
AddStep<ci::security::StepCheckSignature>();
AddStep<wgt::security::StepCheckSettingsLevel>();
AddStep<wgt::filesystem::StepWgtResourceDirectory>();
case ci::RequestType::Update: {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
- AddStep<wgt::parse::StepParse>();
+ AddStep<wgt::parse::StepParse>(true);
AddStep<ci::security::StepCheckSignature>();
AddStep<wgt::security::StepCheckSettingsLevel>();
AddStep<ci::security::StepCheckOldCertificate>();
}
case ci::RequestType::Reinstall: {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
- AddStep<wgt::parse::StepParse>();
+ AddStep<wgt::parse::StepParse>(false);
AddStep<ci::backup::StepOldManifest>();
AddStep<wgt::rds::StepRDSParse>();
AddStep<wgt::rds::StepRDSModify>();