#include <widget_install/task_certificates.h>
#include <widget_install/task_unzip.h>
#include <widget_install/task_commons.h>
-
-#include <widget_install/task_plugins_copy.h>
+#include <widget_install/task_prepare_reinstall.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.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";
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskCertificates(m_installerContext));
- AddTask(new TaskPluginsCopy(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
} else if (result == ConfigureResult::Updated) {
LogInfo("Configure installation updated");
LogInfo("Widget Update");
m_installerContext.job->SetProgressFlag(true);
+
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ AddTask(new TaskPrepareReinstall(m_installerContext));
+ }
+
if (m_installerContext.widgetConfig.packagingType !=
WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
{
AddTask(new TaskRemoveBackupFiles(m_installerContext));
}
- AddTask(new TaskPluginsCopy(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
//TODO: remove widgetHandle from this task and move before database task
Try
{
- std::string tempDir =
- Jobs::WidgetInstall::createTempPath(m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD);
+ std::string tempDir;
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ std::ostringstream tempPathBuilder;
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << widgetPath;
+ tempDir = tempPathBuilder.str();;
+ } else {
+ tempDir =
+ Jobs::WidgetInstall::createTempPath(
+ m_jobStruct.m_installMode ==
+ InstallMode::INSTALL_MODE_PRELOAD);
+ }
m_isDRM = isDRMWidget(widgetPath);
if (true == m_isDRM) {
widgetPath,
tempDir,
m_installerContext.widgetConfig.packagingType,
- m_isDRM);
+ m_isDRM,
+ m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY);
LogDebug("widget packaging type : " <<
m_installerContext.widgetConfig.packagingType.pkgType);
void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
const std::string& tempPath)
{
- m_installerContext.locations =
- WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
- tzPkgid),
- widgetPath, tempPath,
- m_installerContext.widgetConfig.packagingType,
- m_installerContext.locationType);
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ // replace widget path to installed path
+ m_installerContext.locations =
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
+ } else {
+ m_installerContext.locations =
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
+ }
m_installerContext.locations->registerAppid(
DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
LogInfo("incoming version = '" << update.incomingVersion);
LogInfo("Tizen AppID = " << update.tzAppId);
+ if (update.existingVersion.IsNull() || update.incomingVersion.IsNull()) {
+ return ConfigureResult::Failed;
+ }
+
// Check running state
bool isRunning = false;
int retval =
m_installerContext.widgetConfig.tzAppid = update.tzAppId;
if (isUpperVersion(update.existingVersion, update.incomingVersion) ||
- m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
+ (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY) ||
+ (m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY))
{
LogInfo("Whether widget policy allow proceed ok");
return ConfigureResult::Updated;
const std::string &widgetSource,
const std::string &tempPath,
WrtDB::PackagingType pkgType,
- bool isDRM)
+ bool isDRM,
+ bool isReinstall)
{
// Parse config
ParserRunner parser;
DPL::FromUTF32String(
L"widget"))));
} else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
- parser.Parse(widgetSource + '/' + WITH_OSP_XML,
+ std::string configPath;
+ configPath = tempPath;
+ configPath += "/";
+ configPath += WITH_OSP_XML;
+
+ if (isReinstall) {
+ // checking RDS data directory
+ if (access(configPath.c_str(), F_OK) != 0) {
+ std::string tzAppId =
+ widgetSource.substr(widgetSource.find_last_of("/")+1);
+ WidgetDAOReadOnly dao(WidgetDAOReadOnly::getTzAppId(DPL::FromUTF8String(tzAppId)));
+ configPath = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+ configPath += "/";
+ configPath += WITH_OSP_XML;
+ }
+ }
+ parser.Parse(configPath,
ElementParserPtr(
new RootParser<WidgetParser>(
configInfo,
}
WidgetDAOReadOnly dao(tizenId);
+
+ OptionalWidgetVersion optVersion;
+ DPL::OptionalString version = dao.getVersion();
+ if (!version.IsNull()) {
+ optVersion = OptionalWidgetVersion(WidgetVersion(*version));
+ }
+
return WidgetUpdateInfo(
dao.getTzAppId(),
- WidgetVersion(*dao.getVersion()),
+ optVersion,
incomingVersion);
}
const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY ||
+ m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;