-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">\r
-<properties>\r
- <entry key="http://tizen.org/feature/network.push"/>\r
- <entry key="http://tizen.org/feature/network.bluetooth"/>\r
- <entry key="http://tizen.org/feature/network.telephony"/>\r
- <entry key="http://tizen.org/feature/network.telephony.mms"/>\r
- <entry key="http://tizen.org/feature/network.nfc"/>\r
- <entry key="http://tizen.org/feature/network.secure_element"/>\r
- <entry key="http://tizen.org/feature/network.wifi"/>\r
-\r
- <entry key="http://tizen.org/feature/camera"/>\r
- <entry key="http://tizen.org/feature/microphone"/>\r
- <entry key="http://tizen.org/feature/location.gps"/>\r
- <entry key="http://tizen.org/feature/sensor.accelerometer"/>\r
- <entry key="http://tizen.org/feature/sensor.gyroscope"/>\r
- <entry key="http://tizen.org/feature/sensor.magnetometer"/>\r
-\r
- <entry key="http://tizen.org/feature/screen.size.normal"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.720.1280"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.240.400"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.320.480"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.480.800"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.540.960"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.600.1024"/>\r
- <entry key="http://tizen.org/feature/screen.size.normal.1080.1920"/>\r
-\r
-</properties>\r
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+ <entry key="http://tizen.org/feature/network.push"/>
+ <entry key="http://tizen.org/feature/network.bluetooth"/>
+ <entry key="http://tizen.org/feature/network.telephony"/>
+ <entry key="http://tizen.org/feature/network.telephony.mms"/>
+ <entry key="http://tizen.org/feature/network.nfc"/>
+ <entry key="http://tizen.org/feature/network.secure_element"/>
+ <entry key="http://tizen.org/feature/network.wifi"/>
+
+ <entry key="http://tizen.org/feature/camera"/>
+ <entry key="http://tizen.org/feature/microphone"/>
+ <entry key="http://tizen.org/feature/location.gps"/>
+ <entry key="http://tizen.org/feature/sensor.accelerometer"/>
+ <entry key="http://tizen.org/feature/sensor.gyroscope"/>
+ <entry key="http://tizen.org/feature/sensor.magnetometer"/>
+
+ <entry key="http://tizen.org/feature/screen.size.all"/>
+ <entry key="http://tizen.org/feature/screen.size.normal"/>
+ <entry key="http://tizen.org/feature/screen.size.normal.320.480"/>
+ <entry key="http://tizen.org/feature/screen.size.normal.480.800"/>
+ <entry key="http://tizen.org/feature/screen.size.normal.540.960"/>
+ <entry key="http://tizen.org/feature/screen.size.normal.720.1280"/>
+ <entry key="http://tizen.org/feature/screen.size.normal.1080.1920"/>
+</properties>
#git:framework/web/wrt-installer
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.116
+Version: 0.1.118
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
m_exceptionCaught(Jobs::Exceptions::Success)
{
m_installerContext.mode = m_jobStruct.m_installMode;
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_PROGRESS_KEY,
- PKGMGR_START_VALUE);
ConfigureResult result = prepareInstallation(widgetPath);
if (result == ConfigureResult::Ok) {
} else {
// Installation is not allowed to proceed due to widget update policy
LogWarning("Configure installation failed!");
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_PROGRESS_KEY,
+ PKGMGR_START_VALUE);
AddTask(new InstallerTaskFail(result));
}
// Configure installation
result = ConfigureInstallation(widgetPath, configData, tempDir);
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_PROGRESS_KEY,
+ PKGMGR_START_VALUE);
}
Catch(Exceptions::OpenZipFailed)
{
m_installerContext.isUpdateMode = true;
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
result = ConfigureResult::Ok;
m_installerContext.isUpdateMode = false;
m_context.locations->getSharedRootDir());
WrtUtilMakeDir(sharedPath);
+ WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
if (m_context.isUpdateMode) { //update
- std::string backData = m_context.locations->getBackupSharedDir();
- LogDebug("copy shared storage " << backData << " to " << sharedPath);
- if (!DirectoryApi::DirectoryCopy(backData, sharedPath)) {
- LogError("Failed to rename " << backData << " to " << sharedPath);
+ std::string backSharedData = m_context.locations->getBackupSharedDir();
+ std::string BackSharedTrusted = m_context.locations->getBackupSharedDir();
+
+
+ /* Restore /shared/data */
+ LogDebug("copy " << m_context.locations->getBackupSharedDataDir() <<
+ " to " << m_context.locations->getSharedDataDir());
+ if (!DirectoryApi::DirectoryCopy(
+ m_context.locations->getBackupSharedDataDir(),
+ m_context.locations->getSharedDataDir())) {
+ LogError("Failed to rename " <<
+ m_context.locations->getBackupSharedDataDir() <<
+ " to " << m_context.locations->getSharedDataDir());
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs copy shared strage files");
+ }
+
+ /* Restore /shared/trusted */
+ LogDebug("copy " << m_context.locations->getBackupSharedTrustedDir() <<
+ " to " << m_context.locations->getSharedTrustedDir());
+ if (!DirectoryApi::DirectoryCopy(
+ m_context.locations->getBackupSharedTrustedDir(),
+ m_context.locations->getSharedTrustedDir())) {
+ LogError("Failed to rename " <<
+ m_context.locations->getBackupSharedTrustedDir() << " to " <<
+ m_context.locations->getSharedTrustedDir());
ThrowMsg(Exceptions::BackupFailed,
"Error occurs copy shared strage files");
}
} else {
- WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
changeOwnerForDirectory(m_context.locations->getSharedDataDir(),
SHARED_STORAGE_MODE);
changeOwnerForDirectory(m_context.locations->getSharedTrustedDir(),
&& m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
&& m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
- if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
- code = pkgmgr_parser_parse_manifest_for_upgrade(
- m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
+ code = pkgmgr_parser_parse_manifest_for_upgrade(
+ m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
- }
+ if (code != 0) {
+ LogError("Manifest parser error: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
} else {
code = pkgmgr_parser_parse_manifest_for_installation(
#include <dpl/string.h>
#include <dpl/log/log.h>
#include <dpl/foreach.h>
+#include <dpl/utils/wrt_utility.h>
#include <widget_install/widget_install_context.h>
#include <widget_install/widget_install_errors.h>
ThrowMsg(Exceptions::RDSDeltaFailure, "File is missed " << filePath);
}
}
+
+std::string parseSubPath(const std::string& filePath)
+{
+ std::string subPath("");
+ size_t pos = filePath.find_last_of('/') + 1;
+
+ if (pos != std::string::npos) {
+ subPath = filePath.substr(0, pos);
+ }
+ return subPath;
+}
+
+void createDir(const std::string& path)
+{
+ if (WrtUtilMakeDir(path)) {
+ LogDebug("Create directory : " << path);
+ } else {
+ ThrowMsg(Exceptions::RDSDeltaFailure, "Fail to create dir" << path);
+ }
}
+} // namespace anonymous
TaskPrepareReinstall::TaskPrepareReinstall(InstallerContext& context) :
DPL::TaskDecl<TaskPrepareReinstall>(this),
newfile += *file;
std::string destPath = m_installedPath;
destPath += *file;
- if (rename(newfile.c_str(), destPath.c_str()) != 0) {
- ThrowMsg(Exceptions::RDSDeltaFailure,
- "Fail to ADD file " << newfile);
+
+ if (WrtUtilDirExists(newfile)) {
+ // In case of a new directory
+ createDir(destPath);
+ } else {
+ // In case of a new file
+
+ // Parse directory and file separately
+ std::string subPath = parseSubPath(destPath);
+ if (subPath.empty()) {
+ ThrowMsg(Exceptions::RDSDeltaFailure,
+ "Invalid path given" << destPath);
+ }
+
+ // Create a new directory
+ createDir(subPath);
+
+ // Add file
+ if (rename(newfile.c_str(), destPath.c_str()) != 0) {
+ ThrowMsg(Exceptions::RDSDeltaFailure,
+ "Fail to add file " << newfile);
+ }
+ LogDebug("Add " << newfile << " to " << destPath);
}
- LogDebug("Copy " << newfile << " to " << destPath);
}
}
if (m_context.widgetConfig.packagingType !=
WrtDB::PkgType::PKG_TYPE_HYBRID_WEB_APP)
{
- if (PC_OPERATION_SUCCESS != app_install(m_pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_install(m_pkgId)) {
free(m_pkgId);
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
"failure in creating smack rules file.");
Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
#ifdef WRT_SMACK_ENABLED
/* /opt/usr/apps/[pkgid] directory's label is "_" */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getPackageInstallationDir().c_str(),
APP_PATH_ANY_LABEL, "_")) {
LogWarning("Add label to " <<
if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
m_context.mode.extension != InstallMode::ExtensionType::DIR)
{
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getUserDataRootDir().c_str(),
APP_PATH_ANY_LABEL, "_")) {
}
std::string resDir = m_context.locations->getPackageInstallationDir() +
"/res";
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(),
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, resDir.c_str(),
APP_PATH_PRIVATE)) {
LogWarning("Add label to " << resDir);
}
/* data directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getPrivateStorageDir().c_str(),
APP_PATH_PRIVATE)) {
LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
}
/* tmp directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getPrivateTempStorageDir().c_str(),
APP_PATH_PRIVATE))
{
}
/* bin directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getBinaryDir().c_str(),
APP_PATH_PRIVATE)) {
LogWarning("Add label to " << m_context.locations->getBinaryDir());
}
perm_list[index] = NULL;
- if (PC_OPERATION_SUCCESS != app_enable_permissions(appId, APP_TYPE_WGT,
+ if (PC_OPERATION_SUCCESS != perm_app_enable_permissions(appId, APP_TYPE_WGT,
const_cast<const char **>(perm_list), true)) {
LogWarning("failure in contructing smack rules based on perm_list");
}
LogDebug("----------------> SMACK:\
Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()");
#ifdef WRT_SMACK_ENABLED
- if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) {
LogWarning("failure in revoking smack permissions");
}
#endif
Jobs::WidgetInstall::TaskSmack::StepAbortSmack()");
#ifdef WRT_SMACK_ENABLED
- if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) {
LogWarning("failure in revoking smack permissions");
}
- if (PC_OPERATION_SUCCESS != app_uninstall(m_pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_uninstall(m_pkgId)) {
LogWarning("failure in removing smack rules file");
}
free(m_pkgId);
bool TaskSmack::setLabelForSharedDir(const char* pkgId)
{
/* /shared directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getSharedRootDir().c_str(),
APP_PATH_ANY_LABEL, "_")) {
LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
}
/* /shared/res directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getSharedResourceDir().c_str(),
APP_PATH_ANY_LABEL, "_")) {
LogWarning("Add label to " << m_context.locations->getSharedResourceDir());
LogDebug("sha1 label string : " << sha1String);
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getSharedTrustedDir().c_str(),
APP_PATH_GROUP_RW, sha1String.c_str())) {
LogWarning("Add label to " << m_context.locations->getBinaryDir());
}
/* /shared/data directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
m_context.locations->getSharedDataDir().c_str(),
APP_PATH_PUBLIC_RO)) {
LogWarning("Add label to " << m_context.locations->getSharedDataDir());
"------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
#ifdef WRT_SMACK_ENABLED
const char* pkgId = m_context.tzPkgid.c_str();
- if (PC_OPERATION_SUCCESS != app_revoke_permissions(pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(pkgId)) {
LogError("failure in revoking smack permissions");
}
- if (PC_OPERATION_SUCCESS != app_uninstall(pkgId)) {
+ if (PC_OPERATION_SUCCESS != perm_app_uninstall(pkgId)) {
LogError("failure in removing smack rules file");
}
#endif
{
return getBackupDir() + "/shared";
}
+
+std::string WidgetLocation::getBackupSharedDataDir() const
+{
+ return getBackupSharedDir() + "/data";
+}
+
+std::string WidgetLocation::getBackupSharedTrustedDir() const
+{
+ return getBackupSharedDir() + "/trusted";
+}
std::string getSharedDataDir() const; // /opt/usr/apps/[package]/shared/data
std::string getSharedTrustedDir() const; // /opt/usr/apps/[package]/shared/trusted
std::string getBackupSharedDir() const; // /opt/usr/apps/[package].backup/shared
+ std::string getBackupSharedDataDir() const; // /opt/usr/apps/[package].backup/shared/data
+ std::string getBackupSharedTrustedDir() const; // /opt/usr/apps/[package].backup/shared/trusted
// Temporary paths
/**