Update installation storage for sdcard
authorDuyoung Jang <duyoung.jang@samsung.com>
Tue, 18 Jun 2013 11:26:17 +0000 (20:26 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Tue, 18 Jun 2013 11:26:17 +0000 (20:26 +0900)
Change-Id: I1d0dadc4ca8962f13dd26438d0c11b42cabf40d2
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
.cproject
CMakeLists.txt
inc/InstallerDefs.h
packaging/osp-installer.spec
src/Manager/InstallerManager.cpp
src/Step/PackageCheckStep.cpp
src/Step/UnpackStep.cpp
src/Util/InstallerUtil.cpp
src/Util/InstallerUtil.h
src/XmlHandler/ManifestHandler.cpp

index 56968f8..dd360ba 100755 (executable)
--- a/.cproject
+++ b/.cproject
@@ -48,6 +48,7 @@
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;../../osp-appfw/src/base/inc&quot;"/>
                                                                </option>
                                                                <option id="gnu.cpp.link.option.libs.850444138" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
                                                                        <listOptionValue builtIn="false" value="pkgmgr_parser"/>
+                                                                       <listOptionValue builtIn="false" value="vconf"/>
                                                                        <listOptionValue builtIn="false" value="pkgmgr-info"/>
                                                                        <listOptionValue builtIn="false" value="appcore-common"/>
                                                                        <listOptionValue builtIn="false" value="capi-system-info"/>
index fc37b27..602c007 100755 (executable)
@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/cert-svc
        /usr/include/dpl-efl
        /usr/include/appcore
+       /usr/include/vconf
 )
 
 SET (${this_target}_SOURCE_FILES
@@ -81,7 +82,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
 
 TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -lxml2 -lpkgmgr_installer -lpkgmgr_parser -lglib-2.0 -lapp2ext -ldl" -Wl,--allow-shlib-undefined)
-TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib -lcert-svc-vcore -ldpl-efl -lcert-svc -lcapi-system-info -lappcore-common -lpkgmgr-info")
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib -lcert-svc-vcore -ldpl-efl -lcert-svc -lcapi-system-info -lappcore-common -lpkgmgr-info -lvconf")
 
 ADD_SUBDIRECTORY(plugin)
 
index f8c70e6..ddf606d 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130614.1]"
+#define OSP_INSTALLER_VERSION "version=[20130619.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 6edc92e..fabbb3a 100755 (executable)
@@ -20,6 +20,7 @@ BuildRequires:  pkgconfig(dpl-efl)
 BuildRequires:  pkgconfig(cert-svc)
 BuildRequires:  pkgconfig(cert-svc-vcore)
 BuildRequires:  pkgconfig(appcore-common)
+BuildRequires:  pkgconfig(vconf)
 
 BuildRequires:  osp-appfw-internal-devel
 
index 6083af7..6ede15c 100755 (executable)
@@ -1369,8 +1369,9 @@ InstallerManager::RequestMove(const PackageId& packageId, int moveType)
 
                String data(L"data");
                String shared(L"shared");
+               String setting(L"setting");
 
-               if (entryName.Contains(data) || entryName.Contains(shared))
+               if (entryName.Contains(data) || entryName.Contains(shared) || entryName.Contains(setting))
                {
                        pDirDetails->type = APP2EXT_DIR_RW;
                }
index 2b8fc12..ecd9c45 100755 (executable)
@@ -94,13 +94,13 @@ PackageCheckStep::OnStatePackageCheck(void)
        result r = E_SUCCESS;
        String tempDir;
 
-       if (__pContext->__storage == INSTALLATION_STORAGE_INTERNAL)
+       if (__pContext->__storage == INSTALLATION_STORAGE_EXTERNAL)
        {
-               tempDir = DIR_OSP_APPLICATIONS_TEMP;
+               tempDir = DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP;
        }
        else
        {
-               tempDir = DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP;
+               tempDir = DIR_OSP_APPLICATIONS_TEMP;
        }
 
        __pContext->__installDir = tempDir;
index 1a1e7c3..a2a8c70 100755 (executable)
@@ -319,13 +319,13 @@ UnpackStep::AddDirectory(const String& rootDirectory)
        pDirDetails->name = (char*) calloc(1, (sizeof(char) * length) + 1);
        snprintf(pDirDetails->name, length + 1, "%ls", rootDirectory.GetPointer());
 
-       if ((rootDirectory == L"bin") || (rootDirectory == L"res") || (rootDirectory == L"icons"))
+       if ((rootDirectory == L"data") || (rootDirectory == L"shared") || (rootDirectory == L"setting"))
        {
-               pDirDetails->type = APP2EXT_DIR_RO;
+               pDirDetails->type = APP2EXT_DIR_RW;
        }
        else
        {
-               pDirDetails->type = APP2EXT_DIR_RW;
+               pDirDetails->type = APP2EXT_DIR_RO;
        }
 
        AppLog("------------------------------------------");
index 96f2f6d..7be47c6 100755 (executable)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <unique_ptr.h>
+#include <vconf.h>
 
 #include <FBaseErrorDefine.h>
 #include <FIoFile.h>
@@ -1127,3 +1128,34 @@ InstallerUtil::IsCscPackage(const PackageId& packageId, String& cscInfo)
 
        return res;
 }
+
+bool
+InstallerUtil::IsDefaultExternalStorage()
+{
+       int res = 0;
+       int storage = 0;
+       int mmcStatus = VCONFKEY_SYSMAN_MMC_REMOVED;
+
+       res = vconf_get_int("db/setting/default_memory/download", &storage);
+       TryReturn(res == 0, false, "vconf_get_int(db/setting/default_memory/download) failed.");
+
+       AppLog("Storage = [%d]", storage);
+
+       if (storage == 1)
+       {
+               res = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmcStatus);
+               TryReturn(res == 0, false, "vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS) failed.");
+
+               if ((mmcStatus == VCONFKEY_SYSMAN_MMC_REMOVED) || (mmcStatus == VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED))
+               {
+                       AppLog("mmcStatus is MMC_REMOVED or NOT_MOUNTED.");
+               }
+               else
+               {
+                       AppLog("mmcStatus is MMC_MOUNTED.");
+                       return true;
+               }
+       }
+
+       return false;
+}
index 9e17370..3246364 100755 (executable)
@@ -92,6 +92,8 @@ public:
        static bool IsUninstallable(const Tizen::App::PackageId& packageId);
        static bool IsCscPackage(const Tizen::App::PackageId& packageId, Tizen::Base::String& cscInfo);
 
+       static bool IsDefaultExternalStorage();
+
 private:
        static char LogChangeHexToStr(int hex);
        InstallerUtil(const InstallerUtil& value);
index b29d588..34a4ef2 100755 (executable)
@@ -826,7 +826,7 @@ ManifestHandler::OnAppsEndElement(void)
        }
        else
        {
-               if (File::IsFileExist(DIR_MEMORYCARD_INSTALLATION) == true)
+               if (InstallerUtil::IsDefaultExternalStorage() == true)
                {
                        AppLog("INSTALLATION_STORAGE = [EXTERNAL]");
                        __pContext->__storage = INSTALLATION_STORAGE_EXTERNAL;