return true;
}
-bool GrantDefaultPermissions(bf::path pkg_path) {
+bool GrantDefaultPermissions(bf::path pkg_path, bool skip_symlink) {
if (bf::is_directory(pkg_path)) {
if (!GrantPermission755(pkg_path))
return false;
boost::make_iterator_range(bf::directory_iterator(pkg_path), {})) {
auto path = entry.path();
+ if (skip_symlink && bf::is_symlink(symlink_status(path)))
+ continue;
+
// skip path, which is related to mount or directory installer creates
if (bf::is_directory(path) &&
(path.filename() == ".mmc" || path.filename() == ".pkg" ||
namespace common_installer {
namespace filesystem {
+StepChangeOwnershipAndPermission::StepChangeOwnershipAndPermission(
+ InstallerContext* context, bool skip_symlink = false)
+ : Step(context),
+ skip_symlink_(skip_symlink) {
+}
+
Step::Status StepChangeOwnershipAndPermission::precheck() {
if (context_->root_application_path.get().empty()) {
LOG(ERROR) << "root_application_path attribute is empty";
return Status::ERROR;
// Grant default permissions
- if (!GrantDefaultPermissions(context_->pkg_path.get()))
+ if (!GrantDefaultPermissions(context_->pkg_path.get(), skip_symlink_))
return Status::GRANT_PERMISSION_ERROR;
// Change owner of files at root path
public:
using Step::Step;
+ explicit StepChangeOwnershipAndPermission(InstallerContext* context,
+ bool skip_symlink);
+
Status process() override;
Status clean() override { return Status::OK; }
Status undo() override { return Status::OK; }
Status precheck() override;
+
+ bool skip_symlink_;
+
STEP_NAME(ChangeOwnershipAndPermission)
};