return false;
}
- if (strcmp(app->ui_gadget, "true") == 0) {
+ if (app->ui_gadget && strcmp(app->ui_gadget, "true") == 0) {
// Ug-client path
// Make a symlink with the name of appid, pointing /usr/bin/ug-client
bf::path app_exec_path(app->exec);
// Exec path
// Make a symlink with the name of appid, pointing exec file
bf::path symlink_path = bindir / bf::path(app->appid);
- if (!bf::exists(symlink_path)) {
+ bf::path app_exec_path(app->exec);
+ if (!bf::exists(symlink_path) && bf::exists(app_exec_path)) {
LOG(DEBUG) << "Creating symlink " << symlink_path << " pointing " <<
- app->exec;
- bf::create_symlink(bf::path(app->exec), symlink_path, boost_error);
+ app_exec_path;
+ bf::create_symlink(app_exec_path, symlink_path, boost_error);
if (boost_error) {
LOG(ERROR) << "Symlink creation failure: " << symlink_path;
return false;
boost::system::error_code boost_error;
// Give an execution permission to the original executable
LOG(DEBUG) << "Giving exec permission to " << app->exec;
- bf::permissions(bf::path(app->exec), bf::owner_all |
- bf::group_read | bf::group_exe |
- bf::others_read | bf::others_exe, boost_error);
- if (boost_error) {
- LOG(ERROR) << "Permission change failure";
- return false;
+ bf::path app_exec_path(app->exec);
+ if (bf::exists(app_exec_path)) {
+ bf::permissions(app_exec_path, bf::owner_all |
+ bf::group_read | bf::group_exe |
+ bf::others_read | bf::others_exe, boost_error);
+ if (boost_error) {
+ LOG(ERROR) << "Permission change failure";
+ return false;
+ }
+ } else {
+ LOG(WARNING) << "file does not exist";
}
return true;
Step::Status StepParsePreload::process() {
const char* preload_manifest_val = context_->manifest_data.get()->preload;
- bool is_preload = false;
+ if (strcmp(preload_manifest_val, "true") != 0) {
+ bool is_preload = context_->is_preload_request.get();
- if (context_->installation_mode.get() == InstallationMode::OFFLINE) {
- if (strcmp(preload_manifest_val, "false") != 0) {
- is_preload = true;
- }
- } else {
- if (context_->request_type.get() == RequestType::ManifestDirectInstall ||
- context_->request_type.get() == RequestType::ManifestDirectUpdate) {
- if (strcmp(preload_manifest_val, "true") == 0) {
- is_preload = true;
- }
- }
- }
-
- if (is_preload) {
- context_->manifest_data.get()->preload = strdup("true");
+ LOG(INFO) << "is_preload : (" << is_preload << ")";
+ if (is_preload) {
+ context_->manifest_data.get()->preload = strdup("true");
- if (getuid() != 0) {
- LOG(ERROR) << "You're not authorized to install preload app: "
- << context_->pkgid.get().c_str();
- return Status::OPERATION_NOT_ALLOWED;
+ if (getuid() != 0) {
+ LOG(ERROR) << "You're not authorized to install preload app: "
+ << context_->pkgid.get().c_str();
+ return Status::OPERATION_NOT_ALLOWED;
+ }
+ } else {
+ context_->manifest_data.get()->preload = strdup("false");
}
- } else {
- context_->manifest_data.get()->preload = strdup("false");
}
return Status::OK;
};
void RemoveAllRecoveryFiles() {
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
if (!bf::exists(root_path))
return;
for (auto& dir_entry : boost::make_iterator_range(
}
bf::path FindRecoveryFile() {
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
for (auto& dir_entry : boost::make_iterator_range(
bf::directory_iterator(root_path), bf::directory_iterator())) {
if (bf::is_regular_file(dir_entry)) {
bool ValidateFileContentInPackage(const std::string& pkgid,
const std::string& relative,
const std::string& expected) {
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
bf::path file_path = root_path / pkgid / relative;
if (!bf::exists(file_path)) {
LOG(ERROR) << file_path << " doesn't exist";
}
void ValidatePackageFS(const std::string& pkgid, const std::string& appid) {
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
bf::path package_path = root_path / pkgid;
bf::path binary_path = package_path / "bin" / appid;
bf::path data_path = package_path / "data";
}
void PackageCheckCleanup(const std::string& pkgid, const std::string& appid) {
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
bf::path package_path = root_path / pkgid;
ASSERT_FALSE(bf::exists(package_path));
ValidatePackage(pkgid, appid);
// Check delta modifications
- bf::path root_path = ci::GetRootAppPath();
+ bf::path root_path = ci::GetRootAppPath(false);
ASSERT_FALSE(bf::exists(root_path / pkgid / "DELETED"));
ASSERT_TRUE(bf::exists(root_path / pkgid / "ADDED"));
ASSERT_TRUE(bf::exists(root_path / pkgid / "bin" / "native"));