return Step::Status::APP_DIR_ERROR;
ofs.close();
+ // dist signatures cannot be removed when mount install/update
+ if (context_->request_type.get() == RequestType::MountInstall ||
+ context_->request_type.get() == RequestType::MountUpdate)
+ return Step::Status::OK;
+
if (!RemoveSignature(context_->unpacked_dir_path.get()))
return Step::Status::APP_DIR_ERROR;
- for (bf::directory_iterator file(context_->unpacked_dir_path.get());
- file != bf::directory_iterator();
- ++file) {
- try {
- bf::path file_path(file->path());
-
- if (bf::is_symlink(symlink_status(file_path)) ||
- bf::is_directory(file_path))
- continue;
-
- std::regex distributor_regex("^(signature)([1-9][0-9]*)(\\.xml)");
- if (std::regex_search(file_path.filename().string(), distributor_regex)) {
- if (!Remove(file_path)) {
- LOG(ERROR) << "Failed to remove signature file";
- return Step::Status::APP_DIR_ERROR;
- }
- }
- } catch (const bf::filesystem_error& error) {
- LOG(ERROR) << "Failed to remove signature files: " << error.what();
- return Step::Status::APP_DIR_ERROR;
- }
- }
-
sync();
return Step::Status::OK;
}