Fix update logic for preloaded app
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 12 Sep 2013 15:14:21 +0000 (17:14 +0200)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Thu, 12 Sep 2013 23:47:44 +0000 (08:47 +0900)
[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
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_uninstall/job_widget_uninstall.cpp

index 72628c4..938049f 100644 (file)
@@ -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(
index 3ac463b..a06dcf6 100644 (file)
@@ -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() <<
index 2082cbc..efe37e7 100644 (file)
@@ -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)
     {
index deff742..c02adb9 100644 (file)
@@ -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);