return true;
}
-bool CreateSharedRes(const fs::path& src, const fs::path& dst) {
+bool CreateSharedRes(const fs::path& dst) {
std::error_code error;
fs::create_directories(dst / kSharedResPath, error);
return false;
}
- if (!ci::CopyOwnershipAndPermissions(src / "shared", dst / "shared") ||
- !ci::CopyOwnershipAndPermissions(src / kSharedResPath,
- dst / kSharedResPath))
- return false;
-
return true;
}
return false;
}
- if (ShouldBackupSharedRes()) {
- if (!CreateSharedRes(backup_path_, context_->GetPkgPath()))
+ // This is a trick that making installer copy new shared/res contents
+ // instead of move(move will fail by directory not empty error). Because
+ // transmute attribute of smack is not working on move operation.
+ // Early smack labeling is needed because of accessing shared/res from
+ // other applications during package update.
+ bool should_backup_shared_res = ShouldBackupSharedRes();
+ if (should_backup_shared_res) {
+ if (!CreateSharedRes(context_->GetPkgPath()))
return false;
}
LOG(ERROR) << "Failed to set ownership";
return false;
}
+
+ // Set ownership of the contents of shared/res same as installer (originally
+ // it was set as tizenglobalapps by copy operation instead of move) to avoid
+ // access denied error at child process of installer (e.g. dotnet AOT plugin)
+ if (should_backup_shared_res) {
+ if (!ci::SetOwnershipAll(
+ install_path_ / "shared/res", getuid(), getgid())) {
+ LOG(ERROR) << "Failed to set ownership";
+ return false;
+ }
+ }
+
LOG(INFO) << "Successfully move: " << context_->unpacked_dir_path.get()
<< " to: " << install_path_ << " directory";