namespace filesystem {
namespace bf = boost::filesystem;
+namespace ci = common_installer;
+
using common_installer::InstallerContext;
typedef common_installer::Step::Status Status;
-namespace {
-
bool CreateSymLink(application_x* app, InstallerContext* context) {
boost::system::error_code boost_error;
bf::path bindir = context->pkg_path.get() /
return false;
}
- // Exec path
- // Make a symlink with the name of appid, pointing exec file
- bf::path symlink_path = bindir / bf::path(app->appid);
- LOG(DEBUG) << "Creating symlink " << symlink_path << " pointing " <<
- app->exec;
- bf::create_symlink(bf::path(app->exec), symlink_path, boost_error);
- if (boost_error) {
- LOG(ERROR) << "Symlink creation failure: " << symlink_path;
- return false;
+ if (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);
+ if (!bf::exists(app_exec_path)) {
+ bf::path ug_client_path(tzplatform_mkpath(TZ_SYS_BIN, "ug-client"));
+ LOG(INFO) << "Createing symlink " << app_exec_path << " pointing " <<
+ ug_client_path;
+ bf::create_symlink(ug_client_path, app_exec_path, boost_error);
+ if (boost_error) {
+ LOG(ERROR) << "Symlink creation failure: " << app_exec_path;
+ return false;
+ }
+ }
+ } else {
+ if (context->request_type.get() == ci::RequestType::ManifestDirectInstall ||
+ context->request_type.get() == ci::RequestType::ManifestDirectUpdate) {
+ return true;
+ }
+
+ // 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)) {
+ LOG(DEBUG) << "Creating symlink " << symlink_path << " pointing " <<
+ app->exec;
+ bf::create_symlink(bf::path(app->exec), symlink_path, boost_error);
+ if (boost_error) {
+ LOG(ERROR) << "Symlink creation failure: " << symlink_path;
+ return false;
+ }
+ }
}
return true;
return true;
}
-} // namespace
-
Status StepCreateSymbolicLink::precheck() {
manifest_x *m = context_->manifest_data.get();
if (!m) {
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef COMMON_STEP_STEP_PARSE_PRELOAD_H_
-#define COMMON_STEP_STEP_PARSE_PRELOAD_H_
+#ifndef TPK_STEP_STEP_PARSE_PRELOAD_H_
+#define TPK_STEP_STEP_PARSE_PRELOAD_H_
#include <manifest_parser/utils/logging.h>
} // namespace tpk
} // namespace common_installer
-#endif // COMMON_STEP_STEP_PARSE_PRELOAD_H_
+#endif // TPK_STEP_STEP_PARSE_PRELOAD_H_
AddStep<tpk::pkgmgr::StepManifestAdjustment>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
+ AddStep<tpk::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<ci::security::StepRollbackInstallationSecurity>();
AddStep<ci::security::StepRegisterSecurity>();
AddStep<tpk::pkgmgr::StepManifestAdjustment>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
+ AddStep<tpk::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::security::StepRollbackInstallationSecurity>();