Implement recovery of ReadonlyUpdateUninstall 53/282153/1 tizen_5.0
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 13 Sep 2022 12:51:59 +0000 (21:51 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Tue, 27 Sep 2022 08:15:17 +0000 (17:15 +0900)
Change-Id: Ibf742a8003f5d0148d98845360b15e84c0fcd1f7
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
(cherry picked from commit 68f6baaeec21416aeecbbbbb0fc2b4c8695cc975)

src/common/recovery_file.cc
src/common/step/pkgmgr/step_recover_parser_plugins.cc
src/common/step/recovery/step_open_recovery_file.cc
src/common/step/recovery/step_recovery.cc
src/common/step/recovery/step_recovery.h

index c923b462b81253e19d9f27f57acd6f222b9c414e..aca033ff8b501c948ab0e970e9405cf59aec5244 100644 (file)
@@ -31,6 +31,7 @@ const char kRecoveryDeltaString[] = "DELTA";
 const char kRecoveryMountInstallString[] = "MOUNTINSTALL";
 const char kRecoveryMountUpdateString[] = "MOUNTUPDATE";
 const char kRecoveryReadonlyUpdateInstallString[] = "READONLYUPDATEINSTALL";
+const char kRecoveryReadonlyUpdateUninstallString[] = "READONLYUPDATEUNINSTALL";
 const char kRecoveryUnknownString[] = "UNKNOWN";
 
 const std::map<std::string, ci::RequestType> kStringToRequestMap = {
@@ -43,6 +44,8 @@ const std::map<std::string, ci::RequestType> kStringToRequestMap = {
   {kRecoveryMountUpdateString, ci::RequestType::MountUpdate},
   {kRecoveryReadonlyUpdateInstallString,
       ci::RequestType::ReadonlyUpdateInstall},
+  {kRecoveryReadonlyUpdateUninstallString,
+      ci::RequestType::ReadonlyUpdateUninstall},
 };
 
 std::string TruncateNewLine(const char* data) {
@@ -222,6 +225,9 @@ bool RecoveryFile::WriteAndCommitFileContent() {
   case RequestType::ReadonlyUpdateInstall:
     fputs(kRecoveryReadonlyUpdateInstallString, handle);
     break;
+  case RequestType::ReadonlyUpdateUninstall:
+    fputs(kRecoveryReadonlyUpdateUninstallString, handle);
+    break;
   default:
     fputs(kRecoveryUnknownString, handle);
     break;
index 5cbd53f31cba007cdd76cf71e965803982e32a6a..9bb62a322a767d824af3e2650e382b0b64ccf802 100644 (file)
@@ -26,6 +26,7 @@ ci::Plugin::ActionType GetActionType(ci::InstallerContext* context) {
     case ci::RequestType::Delta:
     case ci::RequestType::MountUpdate:
     case ci::RequestType::ReadonlyUpdateInstall:
+    case ci::RequestType::ReadonlyUpdateUninstall:
       return ci::Plugin::ActionType::RecoverUpgrade;
     default:
       LOG(ERROR) << "Invalid request type : " << static_cast<int>(type);
index 4f36c7deb0cd49c7433e39fa1087a318cefc69c6..e54cc1fcca5f3c1b5fc1ed3e110694f889c5ffa1 100644 (file)
@@ -51,6 +51,13 @@ Step::Status StepOpenRecoveryFile::process() {
       context_->root_application_path.set(
           GetRootAppPath(true, context_->uid.get()));
       break;
+    case RequestType::ReadonlyUpdateUninstall:
+      LOG(INFO) << "Running recovery for readonly update uninstallation";
+      context_->request_type.set(RequestType::RecoveryUpdate);
+      context_->is_readonly_package.set(true);
+      context_->root_application_path.set(
+          GetRootAppPath(true, context_->uid.get()));
+      break;
     default:
       LOG(ERROR) << context_->file_path.get() << " is unknown recovery type ("
                  << static_cast<int>(recovery_file->type()) << ")";
index 41b14005a15b6054d90734f08d206ead3e3bce85..f0b77d611ebc020940ba65c95d9d4de01687ba3b 100644 (file)
@@ -25,6 +25,8 @@ Step::Status StepRecovery::process() {
     return RecoveryMountUpdate();
   case RequestType::ReadonlyUpdateInstall:
     return RecoveryReadonlyUpdateInstall();
+  case RequestType::ReadonlyUpdateUninstall:
+    return RecoveryReadonlyUpdateUninstall();
   default:
     LOG(ERROR) << "Recovery is not supported for given type of installation";
     return Status::RECOVERY_ERROR;
@@ -47,5 +49,9 @@ Step::Status StepRecovery::RecoveryReadonlyUpdateInstall() {
   return RecoveryUpdate();
 }
 
+Step::Status StepRecovery::RecoveryReadonlyUpdateUninstall() {
+  return RecoveryReadonlyUpdateInstall();
+}
+
 }  // namespace recovery
 }  // namespace common_installer
index f4653d3f0096d2bd87668fc027dfb801bde4d30d..baede36c099928ce0b5d933af8eb3ca31fc11d13 100644 (file)
@@ -38,6 +38,7 @@ class StepRecovery : public Step {
   virtual Status RecoveryMountNew();
   virtual Status RecoveryMountUpdate();
   virtual Status RecoveryReadonlyUpdateInstall();
+  virtual Status RecoveryReadonlyUpdateUninstall();
 };
 
 }  // namespace recovery