1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_STEP_RDS_STEP_RDS_MODIFY_H_
6 #define COMMON_STEP_RDS_STEP_RDS_MODIFY_H_
8 #include <common/step/step.h>
15 #include "common/installer_context.h"
17 namespace common_installer {
21 * \brief Step that apply RDS modification during reinstallation process
23 class StepRDSModify : public Step {
26 * \brief Explicit constructor
28 * \param context Installer context
30 explicit StepRDSModify(common_installer::InstallerContext* context);
37 Status process() override;
40 * \brief Remove files from temporary location
44 Status clean() override;
47 * \brief Restore files to the state from before RDS installation
51 Status undo() override;
56 * \return Status::ERROR when manifest is missing, pkgid is missing,
57 * or when path to the unpacked directory is missing or not exist,
58 * Status::OK otherwise
60 Status precheck() override;
63 enum class Operation {
69 bool AddFiles(std::filesystem::path unzip_path,
70 std::filesystem::path install_path);
71 bool ModifyFiles(std::filesystem::path unzip_path,
72 std::filesystem::path install_path);
73 bool DeleteFiles(std::filesystem::path install_path);
74 bool SetUpTempBackupDir();
75 void DeleteTempBackupDir();
76 bool PerformBackup(std::string relative_path, Operation operation);
79 std::vector<std::pair<std::string, Operation>> success_modifications_;
80 std::filesystem::path backup_temp_dir_;
81 std::vector<std::string> files_to_modify_;
82 std::vector<std::string> files_to_add_;
83 std::vector<std::string> files_to_delete_;
89 } // namespace common_installer
91 #endif // COMMON_STEP_RDS_STEP_RDS_MODIFY_H_