From: Jihoon Chung Date: Thu, 2 May 2013 07:48:11 +0000 (+0900) Subject: Support preload to writable storage X-Git-Tag: submit/tizen_2.2/20130713.111652^2~170 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b43837c9252df68a1a22c7069a43212327b8cc02;p=platform%2Fframework%2Fweb%2Fwrt-installer.git Support preload to writable storage [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Support install Preload application to a writable storage. This is requirment of operator and preload application can be uninstalled. [SCMRequest] N/A Change-Id: Ibe9af71e1560a01ea8318fc5a9ba2ef28cef5d8d --- diff --git a/src/commons/wrt_common_types.h b/src/commons/wrt_common_types.h index f888c85..965db9c 100644 --- a/src/commons/wrt_common_types.h +++ b/src/commons/wrt_common_types.h @@ -42,7 +42,6 @@ enum InstallLocationType { INSTALL_LOCATION_TYPE_UNKNOWN = 0, INSTALL_LOCATION_TYPE_NOMAL, - INSTALL_LOCATION_TYPE_PRELOAD, INSTALL_LOCATION_TYPE_EXTERNAL }; diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 1382f0e..57475e9 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -295,8 +295,8 @@ ConfigureResult JobWidgetInstall::PrePareInstallation( } else { tempDir = Jobs::WidgetInstall::createTempPath( - m_installerContext.mode.installTime == - InstallMode::InstallTime::PRELOAD); + m_installerContext.mode.rootPath == + InstallMode::RootPath::RO); } m_isDRM = isDRMWidget(widgetPath); @@ -450,7 +450,8 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, tzPkgid), widgetPath, tempPath, m_installerContext.widgetConfig.packagingType, - m_installerContext.locationType); + m_installerContext.mode.rootPath == + InstallMode::RootPath::RO); m_installerContext.locations->registerAppid( DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid)); @@ -1106,18 +1107,11 @@ bool JobWidgetInstall::detectResourceEncryption( } void JobWidgetInstall::setInstallLocationType( - const - WrtDB::ConfigParserData & - configData) + const WrtDB::ConfigParserData & configData) { m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL; - - if (m_installerContext.mode.installTime == InstallMode::InstallTime::PRELOAD) { - m_installerContext.locationType = - INSTALL_LOCATION_TYPE_PRELOAD; - } else { - FOREACH(it, configData.settingsList) - { + if (m_installerContext.mode.installTime != InstallMode::InstallTime::PRELOAD) { + FOREACH(it, configData.settingsList) { if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME && it->m_value == SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) diff --git a/src/jobs/widget_install/task_commons.h b/src/jobs/widget_install/task_commons.h index c87541d..caf9660 100644 --- a/src/jobs/widget_install/task_commons.h +++ b/src/jobs/widget_install/task_commons.h @@ -28,7 +28,7 @@ namespace Jobs { namespace WidgetInstall { //TODO make directory like jobs common? -std::string createTempPath(bool preload = false); +std::string createTempPath(bool isReadOnly = false); void createTempPath(const std::string& path); } // WidgetInstall } // Jobs diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index 111305b..2203828 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -234,7 +234,7 @@ void TaskFileManipulation::StepRenamePath() void TaskFileManipulation::StepLinkForPreload() { - if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { + if (m_context.mode.rootPath == InstallMode::RootPath::RO) { std::string srcDir = m_context.locations->getUserDataRootDir() + WrtDB::GlobalConfig::GetWidgetSrcPath(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 24aa446..44985ce 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -563,7 +563,7 @@ void TaskManifestFile::commitManifest() LogDebug("Commiting manifest file : " << manifest_file); std::ostringstream destFile; - if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { + if (m_context.mode.rootPath == InstallMode::RootPath::RO) { destFile << "/usr/share/packages" << "/"; //TODO constant with path } else { destFile << "/opt/share/packages" << "/"; //TODO constant with path diff --git a/src/misc/widget_location.cpp b/src/misc/widget_location.cpp index f48751f..a0ffb58 100644 --- a/src/misc/widget_location.cpp +++ b/src/misc/widget_location.cpp @@ -25,11 +25,10 @@ #include #include #include - #include -WidgetLocation::DirectoryDeletor::DirectoryDeletor(bool isPreload) : - m_dirpath(Jobs::WidgetInstall::createTempPath(isPreload)) +WidgetLocation::DirectoryDeletor::DirectoryDeletor(bool isReadOnly) : + m_dirpath(Jobs::WidgetInstall::createTempPath(isReadOnly)) {} WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath) : @@ -63,15 +62,14 @@ WidgetLocation::~WidgetLocation() WidgetLocation::WidgetLocation(const std::string & widgetname, std::string sourcePath, WrtDB::PackagingType t, - InstallLocationType locationType) : + bool isReadonly) : m_pkgid(widgetname), m_widgetSource(sourcePath), m_type(t), m_temp( - new WidgetLocation::DirectoryDeletor( - INSTALL_LOCATION_TYPE_PRELOAD == locationType)) + new WidgetLocation::DirectoryDeletor(isReadonly)) { - if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) { + if (isReadonly) { m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath(); } else { m_installedPath += WrtDB::GlobalConfig::GetUserInstalledWidgetPath(); @@ -86,14 +84,13 @@ WidgetLocation::WidgetLocation(const std::string & widgetname, std::string sourcePath, std::string dirPath, WrtDB::PackagingType t, - InstallLocationType locationType) : + bool isReadonly) : m_pkgid(widgetname), m_widgetSource(sourcePath), m_type(t), - m_temp(new - WidgetLocation::DirectoryDeletor(dirPath)) + m_temp(new WidgetLocation::DirectoryDeletor(dirPath)) { - if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) { + if (isReadonly) { m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath(); } else { m_installedPath += WrtDB::GlobalConfig::GetUserInstalledWidgetPath(); diff --git a/src/misc/widget_location.h b/src/misc/widget_location.h index 07ea234..2e5b7c9 100644 --- a/src/misc/widget_location.h +++ b/src/misc/widget_location.h @@ -101,14 +101,12 @@ class WidgetLocation */ WidgetLocation(const std::string & widgetname, std::string sourcePath, WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP, - InstallLocationType ltype = - INSTALL_LOCATION_TYPE_NOMAL); + bool isReadonly = false); WidgetLocation(const std::string & widgetname, std::string sourcePath, std::string dirPath, WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP, - InstallLocationType ltype = - INSTALL_LOCATION_TYPE_NOMAL); + bool isReadonly = false); ~WidgetLocation(); diff --git a/src/wrt-installer/wrt-installer.cpp b/src/wrt-installer/wrt-installer.cpp index b2bccad..77457f5 100644 --- a/src/wrt-installer/wrt-installer.cpp +++ b/src/wrt-installer/wrt-installer.cpp @@ -189,6 +189,16 @@ void WrtInstaller::OnCreate() } m_packagePath = m_argv[2]; m_installMode.installTime = InstallMode::InstallTime::PRELOAD; + m_installMode.rootPath = InstallMode::RootPath::RO; + AddStep(&WrtInstaller::installStep); + } else if (arg == "-ipw" || arg == "--install-preload-writable") { + LogDebug("Install preload web application to writable storage"); + if (m_argc != 3) { + return showHelpAndQuit(); + } + m_packagePath = m_argv[2]; + m_installMode.installTime = InstallMode::InstallTime::PRELOAD; + m_installMode.rootPath = InstallMode::RootPath::RW; AddStep(&WrtInstaller::installStep); } else if (arg == "-c" || arg == "--csc-update") { // "path=/opt/system/csc/Ozq2iEG15R-2.0.0-arm.wgt:op=install:removable=true"