return Step::Status::OK;
}
+Step::Status StepRemoveGlobalAppSymlinks::undo() {
+ if (context_->is_readonly_package.get() ||
+ context_->request_mode.get() == RequestMode::USER)
+ return Step::Status::OK;
+
+ PkgQueryInterface pkg_query(context_->pkgid.get(), kGlobalUserUid);
+ if (!pkg_query.IsPackageInstalled())
+ return Step::Status::OK;
+
+ RequestType req_type = context_->request_type.get();
+ if (req_type == RequestType::Uninstall ||
+ req_type == RequestType::ReadonlyUpdateUninstall) {
+ std::string package_id = context_->pkgid.get();
+ LOG(INFO) << "Creating globalapp symlinks for all user, package: "
+ << package_id;
+ if (!CreateGlobalAppSymlinksForAllUsers(package_id)) {
+ LOG(ERROR) << "Failed to create globalapp symlinks";
+ return Status::GLOBALSYMLINK_ERROR;
+ }
+ }
+
+ return Status::OK;
+}
+
} // namespace filesystem
} // namespace common_installer
Status process() override;
Status clean() override { return Status::OK; }
- Status undo() override { return Status::OK; }
+ Status undo() override;
Status precheck() override { return Status::OK; }
STEP_NAME(RemoveGlobalAppSymlinks)
QueryCertificateAuthorCertificate(
context_->pkgid.get(), context_->uid.get());
context_->certificate_info.get().author_id.set(author_id);
- std::vector<std::unique_ptr<Step>> steps;
- steps.emplace_back(new StepCreateStorageDirectories(
- context_, additional_shared_dirs_));
- steps.emplace_back(new StepCreateGlobalAppSymlinks(context_));
-
- for (auto& it : steps) {
- Step::Status result;
- result = it->precheck();
- if (result != Step::Status::OK) {
- LOG(ERROR) << "Fail to execute precheck of " << it->name();
- return result;
- }
-
- result = it->process();
- if (result != Step::Status::OK) {
- LOG(ERROR) << "Fail to execute process of " << it->name();
- return result;
- }
- }
- return Step::Status::OK;
+
+ StepCreateStorageDirectories step(context_, additional_shared_dirs_);
+
+ return step.process();
}
} // namespace filesystem