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 <boost/filesystem.hpp>
9 #include <common/step/step.h>
14 #include "common/installer_context.h"
16 namespace common_installer {
20 * \brief Step that apply RDS modification during reinstallation process
22 class StepRDSModify : public Step {
25 * \brief Explicit constructor
27 * \param context Installer context
29 explicit StepRDSModify(common_installer::InstallerContext* context);
36 Status process() override;
39 * \brief Remove files from temporary location
43 Status clean() override;
46 * \brief Restore files to the state from before RDS installation
50 Status undo() override;
55 * \return Status::ERROR when manifest is missing, pkgid is missing,
56 * or when path to the unpacked directory is missing or not exist,
57 * Status::OK otherwise
59 Status precheck() override;
62 enum class Operation {
68 bool AddFiles(boost::filesystem::path unzip_path,
69 boost::filesystem::path install_path);
70 bool ModifyFiles(boost::filesystem::path unzip_path,
71 boost::filesystem::path install_path);
72 bool DeleteFiles(boost::filesystem::path install_path);
73 bool SetUpTempBackupDir();
74 void DeleteTempBackupDir();
75 bool PerformBackup(std::string relative_path, Operation operation);
78 std::vector<std::pair<std::string, Operation>> success_modifications_;
79 boost::filesystem::path backup_temp_dir_;
80 std::vector<std::string> files_to_modify_;
81 std::vector<std::string> files_to_add_;
82 std::vector<std::string> files_to_delete_;
88 } // namespace common_installer
90 #endif // COMMON_STEP_RDS_STEP_RDS_MODIFY_H_