install_path_ = context_->GetPkgPath();
backup_path_ = GetBackupPathForPackagePath(context_->GetPkgPath());
- if (!CheckFreeSpace(backup_path_, install_path_ / "shared")) {
+ // We only "copy" shared dir for backup.
+ // So if there is no shared dir, we don't need to check free space.
+ bf::path shared_dir = install_path_ / "shared";
+ if (!bf::exists(shared_dir))
+ return Status::OK;
+
+ if (!CheckFreeSpace(backup_path_, shared_dir)) {
LOG(ERROR) << "not enough space for backup";
return Step::Status::OUT_OF_SPACE;
}