namespace common_installer {
namespace filesystem {
+StepDeltaPatch::StepDeltaPatch(InstallerContext* context,
+ const std::string& delta_root)
+ : Step(context),
+ delta_root_(delta_root) {
+}
+
Step::Status StepDeltaPatch::precheck() {
if (context_->unpacked_dir_path.get().empty()) {
LOG(ERROR) << "Unpacked dir is not set";
return Status::ERROR;
}
- if (!CopyDir(context_->root_application_path.get() / context_->pkgid.get(),
- context_->unpacked_dir_path.get())) {
+ if (!CopyDir(context_->root_application_path.get() / context_->pkgid.get()
+ / delta_root_, context_->unpacked_dir_path.get())) {
LOG(ERROR) << "Failed to copy package files";
return Status::ERROR;
}
- RemoveBinarySymlinks(context_->unpacked_dir_path.get());
- RemoveStorageDirectories(context_->unpacked_dir_path.get());
+ // if there is no root set, that means we need to handle files added by
+ // installer itself (during installation) and files added during runtime
+ // they will be restored in process so just remove extra copy here, so that
+ // it doesn't interfere with installation process
+ if (delta_root_.empty()) {
+ RemoveBinarySymlinks(context_->unpacked_dir_path.get());
+ RemoveStorageDirectories(context_->unpacked_dir_path.get());
+ }
// apply changes mentioned in delta
if (!ApplyPatch(*delta_info, context_->unpacked_dir_path.get(), patch_dir_))
#ifndef COMMON_STEP_STEP_DELTA_PATCH_H_
#define COMMON_STEP_STEP_DELTA_PATCH_H_
-#include "common/installer_context.h"
+#include <string>
+#include "common/installer_context.h"
#include "common/step/step.h"
#include "common/utils/logging.h"
*/
class StepDeltaPatch : public Step {
public:
- using Step::Step;
+ explicit StepDeltaPatch(InstallerContext* context,
+ const std::string& delta_root = "");
Status process() override;
Status clean() override { return Status::OK; }
private:
boost::filesystem::path patch_dir_;
+ std::string delta_root_;
SCOPE_LOG_TAG(DeltaPatch)
};
#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_delta_patch.h"
#include "common/step/step_fail.h"
#include "common/step/step_kill_apps.h"
#include "common/step/step_generate_xml.h"
break;
}
case ci::RequestType::Delta: {
- // TODO(t.iwanek): add proper steps for this mode...
- AddStep<ci::configuration::StepFail>();
+ AddStep<ci::configuration::StepConfigure>(pkgmgr_);
+ AddStep<ci::filesystem::StepUnzip>();
+ // TODO(t.iwanek): manifest is parsed twice...
+ AddStep<wgt::parse::StepParse>(false); // start file may not have changed
+ AddStep<ci::filesystem::StepDeltaPatch>("res/wgt/");
+ AddStep<wgt::parse::StepParse>(true);
+ AddStep<ci::security::StepCheckSignature>();
+ AddStep<wgt::security::StepAddDefaultPrivileges>();
+ AddStep<ci::security::StepPrivilegeCompatibility>();
+ AddStep<wgt::security::StepCheckSettingsLevel>();
+ AddStep<ci::security::StepCheckOldCertificate>();
+ AddStep<wgt::filesystem::StepWgtResourceDirectory>();
+ AddStep<ci::backup::StepOldManifest>();
+ AddStep<ci::pkgmgr::StepKillApps>();
+ AddStep<ci::backup::StepBackupManifest>();
+ AddStep<ci::backup::StepBackupIcons>();
+ AddStep<ci::backup::StepCopyBackup>();
+ AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
+ AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+ AddStep<wgt::filesystem::StepWgtCreateIcons>();
+ AddStep<ci::security::StepUpdateSecurity>();
+ AddStep<ci::pkgmgr::StepGenerateXml>();
+ AddStep<ci::pkgmgr::StepUpdateApplication>();
+ break;
}
case ci::RequestType::Recovery: {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);