write complete result after pkg move
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Wed, 15 May 2013 08:46:21 +0000 (17:46 +0900)
committerAnas Nashif <anas.nashif@intel.com>
Wed, 25 Sep 2013 03:57:57 +0000 (23:57 -0400)
Change-Id: I4006e37e7386d4741bb9ef3665ac7ef1aafec459
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
packaging/app2sd.spec
plugin/app2sd/src/app2sd_interface.c

index 64ba19b..4e1ba3f 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       app2sd
 Summary:    Application installation on external memory
-Version:    0.5.13
+Version:    0.5.14
 Release:    1
 Group:      Application Framework/Application Installer
 License:    Apache-2.0
index 3d94ee0..c114df3 100755 (executable)
@@ -28,6 +28,9 @@
 #include <sys/wait.h>
 #include <pkgmgr-info.h>
 
+#define MAX_BUF_LEN    1024
+#define APP2SD_TMP_PATH "/opt/usr/apps/tmp"
+
 int app2sd_pre_app_install(const char *pkgid, GList* dir_list,
                                int size)
 {
@@ -486,19 +489,24 @@ int app2sd_move_installed_app(const char *pkgid, GList* dir_list,
                        app2ext_move_type move_type)
 {
        int ret = 0;
+       char device_path[MAX_BUF_LEN] = {'\0', };
+       FILE* file = NULL;
+       int fd = 0;
+       char buf[MAX_BUF_LEN] = {'\0'};
 
        /*Validate function arguments*/
        if (pkgid == NULL || dir_list == NULL
                || move_type < APP2EXT_MOVE_TO_EXT
                || move_type > APP2EXT_MOVE_TO_PHONE) {
                app2ext_print("App2Sd Error : Invalid function arguments\n");
-               return APP2EXT_ERROR_INVALID_ARGUMENTS;
+               ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
+               goto END;
        }
 
        ret = _app2sd_move_app(pkgid, move_type, dir_list);
        if (ret) {
                app2ext_print("App2Sd Error : Unable to move application\n");
-               return ret;
+               goto END;
        }
 
        /*If  move is completed, then update installed storage to pkgmgr_parser db*/
@@ -529,6 +537,24 @@ int app2sd_move_installed_app(const char *pkgid, GList* dir_list,
                app2ext_print("pkgmgrinfo_destroy_pkgdbinfo failed\n");
        }
 
+END:
+       snprintf(device_path, MAX_BUF_LEN, "%s/%s", APP2SD_TMP_PATH, pkgid);
+
+       file = fopen(device_path, "w");
+       if (file == NULL) {
+               app2ext_print("fopen failed\n");
+       }
+
+       snprintf(buf, MAX_BUF_LEN - 1, "%d\n", ret);
+       fwrite(buf, 1, strlen(buf), file);
+
+       if (file != NULL) {
+               fflush(file);
+               fd = fileno(file);
+               fsync(fd);
+               fclose(file);
+       }
+
        return ret;
 }