-#git:framework/web/wrt-installer wrt-installer 0.1.23
+#git:framework/web/wrt-installer wrt-installer 0.1.24
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.23
+Version: 0.1.24
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
BuildRequires: pkgconfig(shortcut)
BuildRequires: pkgconfig(dpl-encryption)
BuildRequires: pkgconfig(capi-appfw-app-manager)
-BuildRequires: pkgconfig(drm-service-core-intel)
BuildRequires: pkgconfig(app2sd)
BuildRequires: pkgconfig(web-provider)
BuildRequires: pkgconfig(libprivilege-control)
tapi
shortcut
capi-appfw-app-manager
- drm-service-core-intel
app2sd
vconf
REQUIRED
ElementParser(),
m_data(data),
m_account(data.accountProvider),
- m_properNamespace(false)
+ m_properNamespace(false),
+ m_multiSupport(false)
{}
private:
#include <libiriwrapper.h>
#include <pkg-manager/pkgmgr_signal.h>
#include <app_manager.h>
-//#include <drm_client.h>
-#include <drm-oem-intel.h> //temporary code
#include "root_parser.h"
#include "widget_parser.h"
static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME =
- L"install-location-type";
+ L"install-location";
const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT =
L"prefer-external";
}
}
-bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
+bool JobWidgetInstall::isDRMWidget(std::string /*widgetPath*/)
{
- /* TODO :
- * drm_bool_type_e is_drm_file = DRM_UNKNOWN;
- * int ret = -1;
- *
- * ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
- * if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
- */
-
- /* blow code temporary code for drm. */
- int ret = drm_oem_intel_isDrmFile(const_cast<char*>(widgetPath.c_str()));
- if (1 == ret) {
- return true;
- } else {
- return false;
- }
+ /* TODO */
+ return false;
}
-bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
- std::string destPath)
+bool JobWidgetInstall::DecryptDRMWidget(std::string /*widgetPath*/,
+ std::string /*destPath*/)
{
- /* TODO :
- * drm_trusted_sapps_decrypt_package_info_s package_info;
- *
- * strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
- * sizeof(package_info.sadcf_filepath));
- * strncpy(package_info.decrypt_filepath, destPath.c_str(),
- * sizeof(package_info.decrypt_filepath));
- *
- * drm_trusted_request_type_e requestType =
- * DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
- *
- * int ret = drm_trusted_handle_request(requestType,
- * (void *)&package_info, NULL);
- * if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
- * return true;
- * } else {
- * return false;
- * }
- */
- if (drm_oem_intel_decrypt_package(const_cast<char*>(widgetPath.c_str()),
- const_cast<char*>(destPath.c_str())) != 0)
- {
- return true;
- } else {
- return false;
- }
+ /* TODO */
+ return false;
}
} //namespace WidgetInstall
} //namespace Jobs
namespace {
const char* GLIST_RES_DIR = "res";
-const char* GLIST_BIN_DIR = "bin";
bool _FolderCopy(std::string source, std::string dest)
{
m_extHandle(NULL)
{
if (INSTALL_LOCATION_TYPE_EXTERNAL !=
- m_context.locationType)
+ m_context.locationType)
{
AddStep(&TaskFileManipulation::StepCreateDirs);
AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
{
LogDebug("Step prepare to install in exernal directory");
Try {
- std::string appid =
- DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+ std::string pkgid =
+ DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
- WidgetInstallToExtSingleton::Instance().initialize(appid);
+ WidgetInstallToExtSingleton::Instance().initialize(pkgid);
size_t totalSize =
Utils::getFolderSize(m_context.locations->getTemporaryPackageDir());
GList *list = NULL;
app2ext_dir_details* dirDetail = NULL;
- std::string dirNames[2] = { GLIST_RES_DIR, GLIST_BIN_DIR };
-
- for (int i = 0; i < 2; i++) {
- dirDetail = (app2ext_dir_details*) calloc(1,
- sizeof(
- app2ext_dir_details));
- if (NULL == dirDetail) {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
- "error in app2ext");
- }
- dirDetail->name = strdup(dirNames[i].c_str());
- dirDetail->type = APP2EXT_DIR_RO;
- list = g_list_append(list, dirDetail);
+ dirDetail = (app2ext_dir_details*) calloc(1,
+ sizeof(
+ app2ext_dir_details));
+ if (NULL == dirDetail) {
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "error in app2ext");
}
+ dirDetail->name = strdup(GLIST_RES_DIR);
+ dirDetail->type = APP2EXT_DIR_RO;
+ list = g_list_append(list, dirDetail);
if (m_context.isUpdateMode) {
WidgetInstallToExtSingleton::Instance().preUpgrade(list,
}
free(dirDetail);
g_list_free(list);
+
+ /* make bin directory */
+ std::string widgetBinPath = m_context.locations->getBinaryDir();
+ WrtUtilMakeDir(widgetBinPath);
}
Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
{
m_context.removeAbnormal = false;
m_context.uninstallStep = UninstallerContext::UNINSTALL_START;
m_context.job = this;
- m_context.isExternalWidget = getExternalWidgetFlag();
Try
{
m_exceptionCaught = static_cast<Jobs::Exceptions::Type>(e.getParam());
m_exceptionMessage = e.GetMessage();
}
-
-bool JobWidgetUninstall::getExternalWidgetFlag() const
-{
- LogDebug("Get external widget");
- if (APP2EXT_SD_CARD ==
- app2ext_get_app_location(m_context.tzAppid.c_str()))
- {
- LogDebug("This widget is in external stroage");
- return true;
- }
- return false;
-}
} //namespace WidgetUninstall
} //namespace Jobs
std::string getRemovedTizenId() const;
bool getRemoveStartedFlag() const;
bool getRemoveFinishedFlag() const;
- bool getExternalWidgetFlag() const;
enum class WidgetStatus
{
DPL::TaskDecl<TaskRemoveFiles>(this),
m_context(context)
{
- if (!m_context.isExternalWidget) {
- AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
- } else {
- AddStep(&TaskRemoveFiles::StepRemoveExternalWidget);
- }
+ AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
AddStep(&TaskRemoveFiles::StepRemoveManifest);
AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
AddStep(&TaskRemoveFiles::StepRemoveVconf);
void TaskRemoveFiles::StepRemoveInstallationDirectory()
{
LogInfo("StepRemoveInstallationDirectory started");
-
- m_context.removeStarted = true;
- std::string widgetDir =
- m_context.locations->getPackageInstallationDir();
- if (!WrtUtilRemove(widgetDir)) {
- LogWarning("Removing widget installation directory failed");
- }
- std::string dataDir = m_context.locations->getUserDataRootDir();
- if (!WrtUtilRemove(dataDir)) {
- LogWarning(dataDir + " is already removed");
+ if (APP2EXT_SD_CARD !=
+ app2ext_get_app_location(m_context.tzPkgid.c_str()))
+ {
+ LogDebug("Removing directory");
+ m_context.removeStarted = true;
+ std::string widgetDir =
+ m_context.locations->getPackageInstallationDir();
+ if (!WrtUtilRemove(widgetDir)) {
+ LogWarning("Removing widget installation directory failed");
+ }
+ std::string dataDir = m_context.locations->getUserDataRootDir();
+ if (!WrtUtilRemove(dataDir)) {
+ LogWarning(dataDir + " is already removed");
+ }
+ } else {
+ LogDebug("Removing sdcard directory");
+ Try {
+ WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid);
+ WidgetInstallToExtSingleton::Instance().uninstallation();
+ WidgetInstallToExtSingleton::Instance().deinitialize();
+ }
+ Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
+ {
+ Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
+ }
}
m_context.job->UpdateProgress(
UninstallerContext::UNINSTALL_REMOVE_WIDGETDIR,
}
}
}
-
-void TaskRemoveFiles::StepRemoveExternalWidget()
-{
- Try {
- WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid);
- WidgetInstallToExtSingleton::Instance().uninstallation();
- WidgetInstallToExtSingleton::Instance().deinitialize();
- }
- Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
- {
- Throw(
- Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
- RemoveFilesFailed);
- }
-}
} //namespace WidgetUninstall
} //namespace Jobs
void StepRemoveManifest();
void StepRemoveExternalLocations();
void StepRemoveVconf();
- void StepRemoveExternalWidget();
public:
explicit TaskRemoveFiles(UninstallerContext& context);
Jobs::WidgetUninstall::JobWidgetUninstall *job;
std::string tzAppid;
std::string tzPkgid;
- bool isExternalWidget;
bool removeAbnormal;
};
WrtDB::TizenAppId appid;
- if ((regexec(®, pkg_name,
+ if (!(regexec(®, pkg_name,
static_cast<size_t>(0), NULL, 0) == 0))
{
- WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name));
- appid = WidgetDAOReadOnly::getTzAppId(pkgid);
- } else {
- appid = DPL::FromUTF8String(pkg_name);
+ LogError("Invalid argument : " << pkg_name);
+ return FALSE;
}
- bool result = WidgetDAOReadOnly::isWidgetInstalled(appid);
- WrtDB::WrtDatabase::detachFromThread();
-
- if (result) {
- return TRUE;
- } else {
+ Try {
+ WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name));
+ appid = WidgetDAOReadOnly::getTzAppId(pkgid);
+ LogDebug("appid : " << appid);
+ } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ WrtDB::WrtDatabase::detachFromThread();
return FALSE;
}
+ WrtDB::WrtDatabase::detachFromThread();
+ return TRUE;
}
static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
LogDebug("pkg_plugin_get_app_detail_info() is called");
WrtDB::WrtDatabase::attachToThreadRO();
- int handle = WidgetDAOReadOnly::getHandle(
- DPL::FromUTF8String(pkg_name));
- WidgetDAOReadOnly widget(handle);
+
+ WrtDB::TizenAppId appid;
+ Try {
+ WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name));
+ appid = WidgetDAOReadOnly::getTzAppId(pkgid);
+ LogDebug("appid : " << appid);
+ } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ WrtDB::WrtDatabase::detachFromThread();
+ return FALSE;
+ }
+
+ WidgetDAOReadOnly widget(appid);
DPL::Optional<DPL::String> version = widget.getVersion();
DPL::Optional<DPL::String> id = widget.getGUID();
DPL::ToUTF8String(*version).c_str(),
PKG_VERSION_STRING_LEN_MAX - 1);
}
- snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%d",
- handle);
+ snprintf(pkg_detail_info->pkgid, PKG_NAME_STRING_LEN_MAX, "%s",
+ pkg_name);
+ snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%s",
+ DPL::ToUTF8String(appid).c_str());
WidgetLocalizedInfo localizedInfo;
if (locale.IsNull()) {
- LogError("is NULL");
+ LogDebug("locale is NULL");
DPL::String languageTag(L"");
localizedInfo = widget.getLocalizedInfo(languageTag);
} else {
strncpy(pkg_detail_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
strncpy(pkg_detail_info->pkg_name, pkg_name, PKG_NAME_STRING_LEN_MAX - 1);
+ std::string min_version = DPL::ToUTF8String((*widget.getMinimumWacVersion()));
+
+ strncpy(pkg_detail_info->min_platform_version, min_version.c_str(),
+ PKG_VERSION_STRING_LEN_MAX - 1);
+
/* set installed time */
pkg_detail_info->installed_time = widget.getInstallTime();
Assert(true && "wrong argument is inputed");
}
-const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
-static int wrt_count_plugin;
-
static std::string cutOffFileName(const std::string& path)
{
size_t found = path.find_last_of("/");
static bool checkPaths()
{
bool if_ok = true;
- if_ok &= (checkPath(cutOffFileName(
- GlobalConfig::GetWrtDatabaseFilePath())));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetWrtDatabaseFilePath() <<
- "> does not exist.");
- }
+ if_ok &= (checkPath(cutOffFileName(GlobalConfig::GetWrtDatabaseFilePath())));
if_ok &= (checkPath(GlobalConfig::GetDevicePluginPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetDevicePluginPath() <<
- "> does not exist.");
- }
-
if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
- "> does not exist.");
- }
-
if_ok &= (checkPath(GlobalConfig::GetUserPreloadedWidgetPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetUserPreloadedWidgetPath() <<
- "> does not exist.");
- }
- return if_ok;
-}
-void plugin_install_status_cb(WrtErrStatus status,
- void* userparam)
-{
- Assert(userparam);
-
- wrt_plugin_data *plugin_data = static_cast<wrt_plugin_data*>(userparam);
-
- if (--wrt_count_plugin < 1) {
- LogDebug("All plugins installation completed");
-
- LogDebug("Call SetAllinstallpluginsCallback");
- plugin_data->plugin_installed_cb(plugin_data->user_data);
- }
-
- if (status == WRT_SUCCESS) {
- LogInfo(
- "plugin installation is successful: " <<
- plugin_data->plugin_path);
- return;
- }
-
- LogError("Fail to install plugin : " << plugin_data->plugin_path);
-
- switch (status) {
- case WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED:
- LogError("Failed : Plugin install path is wrong");
- break;
- case WRT_INSTALLER_ERROR_UNKNOWN:
- LogError("Failed : Unkown Error");
- break;
- default:
- break;
- }
-}
-
-void plugin_install_progress_cb(float percent,
- const char* description,
- void* userdata)
-{
- char *plugin_path = static_cast<char*>(userdata);
-
- LogInfo("Install plugin : " << plugin_path <<
- ", Progress : " << percent <<
- ", Description : " << description);
+ return if_ok;
}
EXPORT_API void wrt_installer_init(void *userdata,
UNHANDLED_EXCEPTION_HANDLER_END
}
-EXPORT_API void wrt_install_all_plugins(
- WrtAllPluginInstalledCallback installed_cb,
- void *user_param)
-{
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- std::string installRequest =
- std::string(GlobalConfig::GetPluginInstallInitializerName());
-
- LogDebug("Install new plugins");
-
- Try {
- DPL::Semaphore lock(PLUGIN_INSTALL_SEMAPHORE);
- }
- Catch(DPL::Semaphore::Exception::Base){
- LogError("Failed to create installation lock");
- return;
- }
-
- struct stat tmp;
-
- if (-1 == stat(installRequest.c_str(), &tmp) ||
- !S_ISREG(tmp.st_mode))
- {
- if (ENOENT == errno) {
- LogDebug("Plugin installation not required");
-
- LogDebug("Call SetAllinstallPluginCallback");
- installed_cb(user_param);
-
- DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
- return;
- }
- LogWarning("Opening installation request file failed");
- }
-
- std::string PLUGIN_PATH =
- std::string(GlobalConfig::GetDevicePluginPath());
-
- DIR *dir;
- dir = opendir(PLUGIN_PATH.c_str());
- if (!dir) {
- DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
- return;
- }
-
- LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
- struct dirent libdir;
- struct dirent *result;
- int return_code;
-
- errno = 0;
-
- std::list<std::string> pluginsPaths;
-
- for (return_code = readdir_r(dir, &libdir, &result);
- result != NULL && return_code == 0;
- return_code = readdir_r(dir, &libdir, &result))
- {
- if (strcmp(libdir.d_name, ".") == 0 ||
- strcmp(libdir.d_name, "..") == 0)
- {
- continue;
- }
-
- std::string path = PLUGIN_PATH;
- path += "/";
- path += libdir.d_name;
-
- struct stat tmp;
-
- if (stat(path.c_str(), &tmp) == -1) {
- LogError("Failed to open file" << path);
- continue;
- }
-
- if (!S_ISDIR(tmp.st_mode)) {
- LogError("Not a directory" << path);
- continue;
- }
-
- pluginsPaths.push_back(path);
- }
-
- wrt_count_plugin = pluginsPaths.size();
-
- FOREACH(it, pluginsPaths) {
- wrt_plugin_data *plugin_data = new wrt_plugin_data;
-
- plugin_data->plugin_installed_cb = installed_cb;
- plugin_data->plugin_path = const_cast<char*>(it->c_str());
- plugin_data->user_data = user_param;
-
- wrt_install_plugin(
- it->c_str(), static_cast<void*>(plugin_data),
- plugin_install_status_cb,
- plugin_install_progress_cb);
- }
-
- if (return_code != 0 || errno != 0) {
- LogError("readdir_r() failed with " << DPL::GetErrnoString());
- }
-
- errno = 0;
- if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
- << DPL::GetErrnoString());
- }
-
- if (0 != unlink(installRequest.c_str())) {
- LogError("Failed to remove file initializing plugin "
- "installation");
- }
-
- Try {
- DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
- }
- Catch(DPL::Semaphore::Exception::Base){
- LogInfo("Failed to remove installation lock");
- }
- }
- UNHANDLED_EXCEPTION_HANDLER_END
-}
-
#ifdef __cplusplus
}
#endif
typedef void (*WrtProgressCallback)(float percent,
const char *description,
void *data);
-typedef void (*WrtAllPluginInstalledCallback)(void *userdata);
-
-typedef struct
-{
- WrtAllPluginInstalledCallback plugin_installed_cb;
- char *plugin_path;
- void *user_data;
-} wrt_plugin_data;
enum WrtInstallMode
{
void *userData,
WrtPluginInstallerStatusCallback statusCallback,
WrtProgressCallback progressCallback);
-void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb,
- void *user_param);
#ifdef __cplusplus
}