From 044ed315226875558e67f819416c1eaa1e06c9dd Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 12 Sep 2013 17:14:21 +0200 Subject: [PATCH] Fix update logic for preloaded app [Issue#] LINUXWRT-864 [Problem] Preloader/RO app fails to update [Cause] Shared directory tried to be copied [Solution] "shared" direcotry is already always on RW partion (/opt/usr) so no need "moving". [Verification] Install and update: - preloaded app (run any app wrt-installer -ip [.wgt] (for update same)) - normal app (run any app wrt-installer -i [.wgt] (for update same)) Change-Id: Ia6feb9a9fb41d3256290f61eee9da7c161d53f36 --- src/jobs/widget_install/task_ace_check.cpp | 2 +- src/jobs/widget_install/task_file_manipulation.cpp | 14 +++++++++----- src/jobs/widget_install/task_smack.cpp | 2 +- src/jobs/widget_uninstall/job_widget_uninstall.cpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/jobs/widget_install/task_ace_check.cpp b/src/jobs/widget_install/task_ace_check.cpp index 72628c4..938049f 100644 --- a/src/jobs/widget_install/task_ace_check.cpp +++ b/src/jobs/widget_install/task_ace_check.cpp @@ -79,7 +79,7 @@ void TaskAceCheck::StepAceCheck() //TODO: remove dao.getHandle() if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { - LogDebug("This widget is prealoaded. So ace check will be skiped"); + LogDebug("This widget is preloaded. So ace check will be skiped"); policyResult = ACE_PERMIT; } else { ace_return_t ret = ace_get_policy_result( diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index 3ac463b..a06dcf6 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -260,7 +260,7 @@ void TaskFileManipulation::StepLinkForPreload() WrtDB::GlobalConfig::GetWidgetResPath(); if (0 != access(optRes.c_str(), F_OK)) { - LogDebug("Make symbolic name for preaload app" << + LogDebug("Make symbolic name for preload app" << usrRes << " to " << optRes); if (symlink(usrRes.c_str(), optRes.c_str()) != 0) @@ -279,7 +279,7 @@ void TaskFileManipulation::StepLinkForPreload() std::string dataDir = m_context.locations->getPackageInstallationDir() + "/" + WrtDB::GlobalConfig::GetWidgetPrivateStoragePath(); if (0 != access(dataDir.c_str(), F_OK)) { - LogDebug("Make symbolic name for preaload app " << + LogDebug("Make symbolic name for preload app " << storagePath << " to " << dataDir); if (symlink(storagePath.c_str(), dataDir.c_str()) != 0) @@ -427,9 +427,13 @@ void TaskFileManipulation::StepCreateSharedFolder() changeOwnerForDirectory(m_context.locations->getSharedTrustedDir(), SHARED_STORAGE_MODE); - if (m_context.isUpdateMode) { //update - std::string backSharedData = m_context.locations->getBackupSharedDir(); - std::string BackSharedTrusted = m_context.locations->getBackupSharedDir(); + + // additional check for rootPath installation + // If this app is preloaded, "shared" diretory is already on place and do not needs to be moved + // TODO: why "shared" is on RW partion always but "data" and "tmp" are linked + if (m_context.isUpdateMode + && !(m_context.mode.rootPath == InstallMode::RootPath::RO + && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD)) { /* Restore /shared/data */ LogDebug("copy " << m_context.locations->getBackupSharedDataDir() << diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 2082cbc..efe37e7 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -99,7 +99,7 @@ void TaskSmack::StepSmackFolderLabeling() m_context.locations->getPackageInstallationDir()); } - /* for prealod */ + /* for prelaod */ if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD && m_context.mode.extension != InstallMode::ExtensionType::DIR) { diff --git a/src/jobs/widget_uninstall/job_widget_uninstall.cpp b/src/jobs/widget_uninstall/job_widget_uninstall.cpp index deff742..c02adb9 100644 --- a/src/jobs/widget_uninstall/job_widget_uninstall.cpp +++ b/src/jobs/widget_uninstall/job_widget_uninstall.cpp @@ -166,7 +166,7 @@ WidgetStatus JobWidgetUninstall::getWidgetStatus(const std::string &id) installPath = DPL::Utils::Path(*dao.getWidgetInstalledPath()); } if(installPath.isSubPath(PRELOAD_INSTALLED_PATH)){ - LogDebug("This widget is prealoded."); + LogDebug("This widget is preloaded."); } } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { LogDebug("package id : " << pkgId); -- 2.7.4