OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
OPTION(CSP_SUPPORT "Support for csp policy" ON)
OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
+OPTION(SMACK "Enable smack support" ON)
+OPTION(DECRYPT_SUPPORT "Enable appmanager capabilities" ON)
+IF(DECRYPT_SUPPORT)
+ ADD_DEFINITIONS("-DDECRYPT")
+ENDIF(DECRYPT_SUPPORT)
+ OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
+
############################# compiler flags ##################################
SET(CMAKE_C_FLAGS_PROFILING "-O2")
ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
ADD_DEFINITIONS("-std=c++0x") # accept C++11x standard
-
-ADD_DEFINITIONS("-DWRT_SMACK_ENABLED") # enable smack
+IF(SMACK)
- ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
++ ADD_DEFINITIONS("-DWRT_SMACK_ENABLED") # enable smack
+ENDIF(SMACK)
+ ADD_DEFINITIONS("-DWRT_INSTALLER_LOG") # enable installer log
############################# Targets names ###################################
-#git:framework/web/wrt-installer
+%bcond_with livebox
+%bcond_with decrypt
Name: wrt-installer
Summary: Installer for tizen Webruntime
- Version: 0.1.58.2
+ Version: 0.1.128
Release: 1
Group: Development/Libraries
-License: Apache License, Version 2.0
-URL: N/A
+License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
+Source100: wrt-preinstall-widgets.service
+Source1001: wrt-installer.manifest
BuildRequires: cmake
BuildRequires: edje-tools
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(wrt-plugins-types)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(shortcut)
- BuildRequires: pkgconfig(dpl-encryption)
BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: pkgconfig(app2sd)
+%if %{with livebox}
BuildRequires: pkgconfig(web-provider)
+%endif
BuildRequires: pkgconfig(libprivilege-control)
BuildRequires: pkgconfig(libsmack)
- %if %{with decrypt}
- BuildRequires: pkgconfig(osp-appfw)
- BuildRequires: osp-appfw-internal-devel
- Requires: osp-appfw
- %endif
+ BuildRequires: libss-client-devel
+ Requires: libss-client
+ Requires: osp-installer
Requires: xmlsec1
%description
%endif
%build
+ %if 0%{?tizen_build_binary_release_type_eng}
+ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+ export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+ %endif
-export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed"
+export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
LDFLAGS="$LDFLAGS"
-cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+%cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+%if %{with livebox}
+ -DLIVEBOX_SUPPORT=On \
+%else
+ -DLIVEBOX_SUPPORT=Off \
+%endif
+%if %{with decrypt}
+ -DDECRYPT_SUPPORT=On \
+%else
+ -DDECRYPT_SUPPORT=Off \
+%endif
+ -DSMACK=Off \
-DDPL_LOG=ON \
-DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
%{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
chmod +s /usr/bin/wrt-installer
#symlink for package manager
- ln -sf /usr/bin/wrt-installer /etc/package-manager/backend/wgt
+ %define pkg_manager_backend_path "/usr/etc/package-manager/backend"
+ ln -sf /usr/bin/wrt-installer %{pkg_manager_backend_path}/wgt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/Wgt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wGt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wgT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WGt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wGT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WgT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WGT
-
#for booting recovery
mkdir -p /opt/share/widget/temp_info
%postun -p /sbin/ldconfig
%files
-%manifest wrt-installer.manifest
+%manifest %{name}.manifest
%attr(755,root,root) %{_bindir}/wrt-installer
- /etc/package-manager/backendlib/libwgt.so
- %{_datadir}/license/%{name}
+%{_unitdir}/graphical.target.wants/wrt-preinstall-widgets.service
- %{_unitdir}/wrt-preinstall-widgets.service
- /usr/bin/wrt_preinstall_widgets.sh
- %dir /opt/share/packages
- %dir /opt/usr/apps/.preinstallWidgets
+ /usr/etc/package-manager/backendlib/libwgt.so
+ %attr(644,root,root) /usr/etc/wrt-installer/*.xsd
+ %{_datadir}/license/%{name}
%if %{with_tests}
%attr(755,root,root) %{_bindir}/wrt-installer-tests-*
/opt/share/widget/tests/installer/widgets/*
virtual void Verify()
{
+#ifdef LIVEBOX
+ if (m_liveboxId.empty()) {
+ ThrowMsg(Exception::ParseError,
+ "app-widget element must have id attribute");
+ }
+ else
+ {
+ pcrecpp::RE re(REGEXP_ID_STRING.c_str());
+ if (!re.FullMatch(DPL::ToUTF8String(m_liveboxId)))
+ {
+ ThrowMsg(Exception::ParseError,
+ "invalid format of app-widget id attribute");
+ }
+ }
+
+ if (m_primary.empty())
+ {
+ ThrowMsg(Exception::ParseError,
+ "app-widget element must have primary attribute");
+ } else if (CheckIfNotTrueNorFalse(m_primary))
+ {
+ ThrowMsg(Exception::ParseError,
+ "auto-launch attribute of app-widget element should be true or false - ignoring");
+ }
+
+ if (!m_autoLaunch.empty() &&
+ CheckIfNotTrueNorFalse(m_autoLaunch))
+ {
+ ThrowMsg(Exception::ParseError,
+ "auto-launch attribute of app-widget element should be true or false - ignoring");
+ }
+
+ if (!m_updatePeriod.empty())
+ {
+ char * endptr;
+ errno = 0;
+ std::string tempStr = DPL::ToUTF8String(m_updatePeriod);
+
+ //set standard locale to fix decimal point mark - '.'
+ std::string currentLocale = setlocale(LC_NUMERIC, NULL);
+ if (NULL == setlocale(LC_NUMERIC, "C"))
+ _W("Failed to change locale to \"C\"");
+ double updatePeriod = strtod(tempStr.c_str(), &endptr);
+
+ //go back to previous locale
+ if (NULL == setlocale(LC_NUMERIC, currentLocale.c_str()))
+ _W("Failed to set previous locale");
+
+ if ((errno == ERANGE && (updatePeriod == -HUGE_VAL || updatePeriod == HUGE_VAL))
+ || *endptr != '\0') {
+ ThrowMsg(Exception::ParseError,
+ "update-period attribute of app-widget element should be a number - ignoring. current value: " << m_updatePeriod);
+ } else if (updatePeriod < 1800.0) {
+ _D("update-period attribute of app-widget element shouldn't be less than 1800.0 - changed to 1800 from value: %ls", m_updatePeriod.c_str());
+ m_updatePeriod = L"1800.0";
+ }
+ }
+
+ if (m_autoLaunch.empty()) {
+ m_autoLaunch = L"false";
+ }
+
+ if(m_livebox.m_label.empty()) {
+ ThrowMsg(Exception::ParseError,
+ "box-label element of app-widget element not found - ignoring");
+ }
+
+ if(!m_boxContentFound) {
+ ThrowMsg(Exception::ParseError,
+ "box-content element of app-widget element not found - ignoring");
+ }
+
m_livebox.m_liveboxId = m_liveboxId;
+#endif
m_livebox.m_primary = m_primary;
m_livebox.m_autoLaunch = m_autoLaunch;
m_livebox.m_updatePeriod = m_updatePeriod;
}
private:
+ static std::string REGEXP_ID_STRING;
ConfigParserData& m_data;
ConfigParserData::LiveboxInfo m_livebox;
+#ifdef LIVEBOX
DPL::String m_liveboxId;
+#endif
DPL::String m_primary;
DPL::String m_autoLaunch;
DPL::String m_updatePeriod;
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
+#ifdef LIVEBOX
#include <web_provider_livebox_info.h>
+#endif
#include <dpl/wrt-dao-rw/widget_dao.h>
- #include <dpl/wrt-dao-ro/vconf_config.h>
#include <dpl/foreach.h>
#include <dpl/utils/wrt_utility.h>
- #include <dpl/log/log.h>
#include <dpl/assert.h>
#include <wrt-commons/security-origin-dao/security_origin_dao.h>
+ #include <wrt-commons/widget-interface-dao/widget_interface_dao.h>
+ #include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/wrt-dao-ro/widget_dao_types.h>
#include <string>
#include <sstream>
AddStep(&TaskDatabase::StepWrtDBInsert);
AddStep(&TaskDatabase::StepAceDBInsert);
AddStep(&TaskDatabase::StepSecurityOriginDBInsert);
+ AddStep(&TaskDatabase::StepWidgetInterfaceDBInsert);
AddStep(&TaskDatabase::StepRemoveExternalFiles);
- AddStep(&TaskDatabase::StepCreateVconf);
+#ifdef LIVEBOX
AddStep(&TaskDatabase::StepLiveboxDBInsert);
+#endif
+ AddStep(&TaskDatabase::EndStep);
+
AddAbortStep(&TaskDatabase::StepAbortDBInsert);
AddAbortStep(&TaskDatabase::StepAbortAceDBInsert);
+ AddAbortStep(&TaskDatabase::StepAbortWidgetInterfaceDBInsert);
}
void TaskDatabase::StepWrtDBInsert()
if (!AceApi::registerAceWidgetFromDB(m_handleToRemove))
{
- LogError("ace database restore failed");
+ _E("ace database restore failed");
+ }
+ _D("Ace data inserted");
+ }
+
+ void TaskDatabase::StepAbortWidgetInterfaceDBInsert()
+ {
+ _D("[DB Update Task] Widget interface Aborting...");
+ using namespace WidgetInterfaceDB;
+ using namespace WrtDB;
+
+ DbWidgetHandle handle =
+ WidgetDAOReadOnly::getHandle(m_context.widgetConfig.tzAppid);
+ std::string dbPath = WidgetInterfaceDAO::databaseFileName(handle);
+
+ // remove database
+ if (remove(dbPath.c_str()) != 0) {
+ _W("Fail to remove");
+ }
+
+ // rollback database
+ if (m_context.isUpdateMode) {
+ std::string backupDbPath = dbPath;
+ backupDbPath += GlobalConfig::GetBackupDatabaseSuffix();
+ _D("\"%s\" to \"%s\"", dbPath.c_str(), backupDbPath.c_str());
+ if (0 != std::rename(backupDbPath.c_str(), dbPath.c_str())) {
+ _W("Fail to rollback");
+ }
}
- LogDebug("Ace data inserted");
}
+#ifdef LIVEBOX
void TaskDatabase::StepLiveboxDBInsert()
{
if (m_context.widgetConfig.configInfo.m_livebox.size() <= 0) {
autoLaunch, mouseEvent, pdFastOpen);
}
}
+#endif // LIVEBOX
+
+ void TaskDatabase::StartStep()
+ {
+ _D("--------- <TaskDatabase> : START ----------");
+ }
+
+ void TaskDatabase::EndStep()
+ {
+ _D("--------- <TaskDatabase> : END ----------");
+ }
} //namespace WidgetInstall
} //namespace Jobs
void StepWrtDBInsert();
void StepAceDBInsert();
void StepSecurityOriginDBInsert();
+ void StepWidgetInterfaceDBInsert();
void StepRemoveExternalFiles();
- void StepCreateVconf();
+#ifdef LIVEBOX
void StepLiveboxDBInsert();
-
+#endif
void StepAbortDBInsert();
void StepAbortAceDBInsert();
+ void StepAbortWidgetInterfaceDBInsert();
+
+ void StartStep();
+ void EndStep();
public:
TaskDatabase(InstallerContext& context);
}
} while ((bytesWritten != bytesToWrite) && (EINTR == errno));
}
+#ifdef DECRYPT
- /*
- * get encrypted string from trustzone
- */
- Tizen::Base::ByteBuffer* EncryptChunkByTrustZone(
- Tizen::Base::ByteBuffer* appInfo,
- const unsigned char *plainBuffer,
- int pBufSize)
- {
- using namespace Tizen::Base;
- if(!initWebApp)
- {
- char* pAppId = null;
- pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
- memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
- InitWebAppInfo(pAppId, "");
- free (pAppId);
- initWebApp = true;
- }
-
- Tizen::Security::Crypto::_TrustZoneService* pInstance;
- pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
- ByteBuffer pBuf;
- pBuf.Construct(pBufSize);
- const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
- if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
- LogDebug("Couldnot set pBuf");
- return NULL;
- }
- pBuf.Flip();
-
- return pInstance->_TrustZoneService::EncryptN(*appInfo, pBuf);
- }
-
- Tizen::Base::ByteBuffer* TEST_dec(
- Tizen::Base::ByteBuffer* appInfo,
- const unsigned char *plainBuffer,
- int pBufSize)
+ int ssmEncrypt(InstallMode::RootPath rootPath, std::string pkgId, const char*
+ inChunk, int inBytes, char** outChunk, int *outBytes)
{
- using namespace Tizen::Base;
-
- Tizen::Security::Crypto::_TrustZoneService* pInstance;
- pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
- ByteBuffer pBuf;
- pBuf.Construct(pBufSize);
- const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
- if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
- LogDebug("Couldnot set pBuf");
- return NULL;
+ if (rootPath == InstallMode::RootPath::RO) {
+ return ssm_encrypt_preloaded_application(inChunk, inBytes,
+ outChunk, outBytes);
+ } else {
+ return ssm_encrypt(pkgId.c_str(), pkgId.length(),
+ inChunk, inBytes,
+ outChunk, outBytes);
}
- pBuf.Flip();
-
- return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
}
+#endif
}
namespace Jobs {
DPL::TaskDecl<TaskEncryptResource>(this),
m_context(context)
{
-
+ AddStep(&TaskEncryptResource::StartStep);
+#ifdef DECRYPT
AddStep(&TaskEncryptResource::StepEncryptResource);
+#endif
+ AddStep(&TaskEncryptResource::EndStep);
}
+#ifdef DECRYPT
void TaskEncryptResource::StepEncryptResource()
{
m_context.widgetConfig.encryptedFiles.insert(fileInfo);
}
+#endif
+
+ void TaskEncryptResource::StartStep()
+ {
+ _D("--------- <TaskEncryptResource> : START ----------");
+ }
+
+ void TaskEncryptResource::EndStep()
+ {
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_ECRYPTION_FILES,
+ "Ecrypt resource files");
+
+ _D("--------- <TaskEncryptResource> : END ----------");
+ }
} //namespace WidgetInstall
} //namespace Jobs
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
+#ifdef LIVEBOX
#include <web_provider_livebox_info.h>
#include <web_provider_plugin_info.h>
+#endif
#include <dpl/wrt-dao-ro/global_config.h>
- #include <dpl/log/log.h>
+ #include <dpl/wrt-dao-ro/config_parser_data.h>
#include <dpl/file_input.h>
#include <dpl/errno_string.h>
#include <dpl/file_output.h>
// for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
+#ifdef LIVEBOX
AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
+#endif
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseUpgradedManifest);
- AddStep(&TaskManifestFile::stepUpdateFinalize);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
} else {
AddStep(&TaskManifestFile::stepCopyIconFiles);
+#ifdef LIVEBOX
AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
+#endif
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
- AddStep(&TaskManifestFile::stepFinalize);
-
- AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
}
}
"Widget iconfile copy Finished");
}
+#ifdef LIVEBOX
void TaskManifestFile::stepCopyLiveboxFiles()
{
- LogDebug("Copy Livebox Files");
+ _D("Copy Livebox Files");
using namespace WrtDB;
ConfigParserData &data = m_context.widgetConfig.configInfo;
InstallerContext::INSTALL_COPY_LIVEBOX_FILES,
"Livebox files copy Finished");
}
+#endif // LIVEBOX
+ void TaskManifestFile::copyDynamicBoxFile(const std::string& sourceFile,
+ const std::string& targetFile)
+ {
+ Try
+ {
+ DPL::FileInput input(sourceFile);
+ DPL::FileOutput output(targetFile);
+ DPL::Copy(&input, &output);
+ }
+ Catch(DPL::Exception)
+ {
+ _E("Copying Dynamic Box File Failed. %s to %s", sourceFile.c_str(), targetFile.c_str());
+ ReThrowMsg(Exceptions::DynamicBoxFailed, "Dynamic Box File Copy Failed.");
+ }
+ }
+
+ bool TaskManifestFile::addBoxUiApplication(Manifest& manifest)
+ {
+ UiApplication uiApp;
+ std::string postfix = ".d-box";
+ static bool isAdded = false;
+
+ Try
+ {
+ if (isAdded) {
+ _D("UiApplication for d-box is already added");
+ return false;
+ }
+ uiApp.setNodisplay(true);
+ uiApp.setTaskmanage(false);
+ uiApp.setMultiple(false);
+ setWidgetName(manifest, uiApp);
+ setWidgetIcons(uiApp);
+
+ // appid for box is like [webapp id].d-box
+ setWidgetIds(manifest, uiApp, postfix);
+ // executable path for box is like [app path]/bin/[webapp id].d-box
+ setWidgetExecPath(uiApp, postfix);
+ manifest.addUiApplication(uiApp);
+ isAdded = true;
+
+ return true;
+ }
+ Catch(DPL::Exception)
+ {
+ _E("Adding UiApplication on xml is failed.");
+ isAdded = false;
+ return false;
+ }
+ }
+
void TaskManifestFile::stepBackupIconFiles()
{
- LogDebug("Backup Icon Files");
+ _D("Backup Icon Files");
backup_dir << m_context.locations->getBackupDir() << "/";
}
}
- void TaskManifestFile::stepAbortParseManifest()
++#ifdef LIVEBOX
+ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
{
- LogError("[Parse Manifest] Abroting....");
-
- int code = pkgmgr_parser_parse_manifest_for_uninstallation(
- DPL::ToUTF8String(manifest_file).c_str(), NULL);
+ ConfigParserData::LiveboxList& liveboxList =
+ m_context.widgetConfig.configInfo.m_livebox;
- if (0 != code) {
- LogWarning("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ if (liveboxList.empty()) {
+ _D("no livebox");
+ return;
}
- int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
- if (0 != ret) {
- LogWarning("No manifest file found: " << manifest_file);
+
+ if (!addBoxUiApplication(manifest)) {
+ _D("error during adding UiApplication for d-box");
+ return;
}
- }
- #ifdef LIVEBOX
- void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
- {
- FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
- LogInfo("setLiveBoxInfo");
+ FOREACH(it, liveboxList) {
+ _D("setLiveBoxInfo");
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
DPL::String appid = m_context.widgetConfig.tzAppid;
#endif
}
- void TaskSmack::SetEndofInstallation()
- {
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_END,
- "End installation");
- }
-
bool TaskSmack::setLabelForSharedDir(const char* pkgId)
{
- /* shared directory */
- if (PC_OPERATION_SUCCESS != app_label_dir("*",
- m_context.locations->getSharedRootDir().c_str())) {
- return false;
+#ifdef WRT_SMACK_LABEL
+ /* /shared directory */
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+ m_context.locations->getSharedRootDir().c_str(),
+ APP_PATH_ANY_LABEL, "_")) {
+ _W("Add label to %s", m_context.locations->getUserDataRootDir().c_str());
}
- /* shared/res directory */
- if (PC_OPERATION_SUCCESS != app_label_dir("_",
- m_context.locations->getSharedResourceDir().c_str())) {
- return false;
+ /* /shared/res directory */
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+ m_context.locations->getSharedResourceDir().c_str(),
+ APP_PATH_ANY_LABEL, "_")) {
+ _W("Add label to %s", m_context.locations->getSharedResourceDir().c_str());
}
- /* shared/trusted directory */
- CertificatePtr rootCert = m_context.wacSecurity.getAuthorCertificatePtr();
+ /* /shared/trusted directory */
+ CertificatePtr rootCert = m_context.widgetSecurity.getAuthorCertificatePtr();
if (rootCert.Get() != NULL) {
ValidationCore::Crypto::Hash::SHA1 sha1;
sha1.Append(rootCert->getDER());
}
}
- /* shared/data directory */
- std::string dataLabel = std::string(pkgId) + "_shareddata";
- TizenPkgIdList pkgList = WidgetDAOReadOnly::getTizenPkgidList();
- const char** pList = new (std::nothrow) const char*[pkgList.size() + 1];
-
- int index = 0;
- FOREACH(app, pkgList) {
- std::string id = DPL::ToUTF8String(*app);
- char *pId = new char[id.size() + 1];
- snprintf(pId, id.length() + 1, "%s", id.c_str());
- pList[index++] = pId;
+ /* /shared/data directory */
+ if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+ m_context.locations->getSharedDataDir().c_str(),
+ APP_PATH_PUBLIC_RO)) {
+ _W("Add label to %s", m_context.locations->getSharedDataDir().c_str());
}
- pList[index] = NULL;
- if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
- dataLabel.c_str(),
- m_context.locations->getSharedDataDir().c_str())) {
- freeList(pList);
- return false;
- }
- if (PC_OPERATION_SUCCESS != add_shared_dir_readers(dataLabel.c_str(), pList)) {
- freeList(pList);
- return false;
- }
- if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
- "*",
- m_context.locations->getSharedDataDir().c_str())) {
- freeList(pList);
- return false;
- }
- freeList(pList);
+#endif
return true;
}
+
+ void TaskSmack::StartStep()
+ {
+ _D("--------- <TaskSmack> : START ----------");
+ }
+
+ void TaskSmack::EndStep()
+ {
+ _D("--------- <TaskSmack> : END ----------");
+ }
} //namespace WidgetInstall
} //namespace Jobs
DPL::TaskDecl<TaskDbUpdate>(this),
m_context(context)
{
+ AddStep(&TaskDbUpdate::StartStep);
+ AddStep(&TaskDbUpdate::StepRemoveExternalLocations);
AddStep(&TaskDbUpdate::StepDbUpdate);
+#ifdef LIVEBOX
AddStep(&TaskDbUpdate::StepLiveboxDBDelete);
+#endif
+ AddStep(&TaskDbUpdate::EndStep);
}
TaskDbUpdate::~TaskDbUpdate()
ReThrowMsg(Exceptions::DatabaseFailure,
"Failed to handle StepDbUpdate!");
}
-
- m_context.job->UpdateProgress(
- UninstallerContext::UNINSTALL_DB_UPDATE,
- "Widget DB Update Finished");
}
+#ifdef LIVEBOX
void TaskDbUpdate::StepLiveboxDBDelete()
{
int ret =
web_provider_livebox_delete_by_app_id(m_context.tzAppid.c_str());
if (ret < 0) {
- LogDebug("failed to delete box info");
+ _D("failed to delete box info");
} else {
- LogInfo("delete box info: " << m_context.tzAppid);
+ _D("delete box info: %s", m_context.tzAppid.c_str());
}
}
+#endif // LIVEBOX
+
+ void TaskDbUpdate::StepRemoveExternalLocations()
+ {
+ if (!m_context.removeAbnormal) {
+ WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
+ _D("Removing external locations:");
+ WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
+ FOREACH(file, externalPaths)
+ {
+ DPL::Utils::Path path(*file);
+ if(path.Exists()){
+ if(path.IsFile()){
+ _D(" -> %s", path.Fullpath().c_str());
+ Try{
+ DPL::Utils::Remove(path);
+ }Catch(DPL::Utils::Path::BaseException){
+ _E("Failed to remove the file: %s", path.Fullpath().c_str());
+ }
+ } else if (path.IsDir()){
+ _D(" -> %s", path.Fullpath().c_str());
+ Try{
+ DPL::Utils::Remove(path);
+ }Catch(DPL::Utils::Path::BaseException){
+ Throw(Jobs::WidgetUninstall::TaskDbUpdate::
+ Exception::RemoveFilesFailed);
+ }
+ }
+ }else{
+ _W(" -> %s(no such a path)", path.Fullpath().c_str());
+ }
+ }
+ dao.unregisterAllExternalLocations();
+ }
+ }
+
+ void TaskDbUpdate::StartStep()
+ {
+ _D("--------- <TaskDbUpdate> : START ----------");
+ }
+
+ void TaskDbUpdate::EndStep()
+ {
+ m_context.job->UpdateProgress(
+ UninstallerContext::UNINSTALL_DB_UPDATE,
+ "Widget DB Update Finished");
+
+ _D("--------- <TaskDbUpdate> : END ----------");
+ }
} //namespace WidgetUninstall
} //namespace Jobs