Skip checking reference when installing preload pkgs 63/140463/3
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 25 Jul 2017 05:59:13 +0000 (14:59 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 25 Jul 2017 09:06:12 +0000 (18:06 +0900)
Requires:
 - https://review.tizen.org/gerrit/139436

Change-Id: I44eae5ac3c05fe14fe0bceb084bf1f3e06456515
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/install_preload_pkg.c

index 58439e5..8fda943 100644 (file)
@@ -55,7 +55,7 @@
 #define WGT_RW_DIR tzplatform_mkpath(TZ_SYS_RO_APP, ".preload-rw-wgt")
 
 static int _install_preload_pkg(const char *backend, const char *directory,
-               bool readonly)
+               bool readonly, bool skip_reference_check)
 {
        DIR *dir;
        struct dirent *file_info;
@@ -89,6 +89,9 @@ static int _install_preload_pkg(const char *backend, const char *directory,
                if (pid == 0) {
                        execl(backend, backend, "-i", file_path,
                                readonly ? "--preload" : "--preload-rw",
+                               skip_reference_check ?
+                                       "--skip-check-reference" :
+                                       "",
                                (char *)NULL);
                } else if (pid < 0) {
                        _E("failed to fork and execute %s!", backend);
@@ -135,22 +138,30 @@ int main(int argc, char *argv[])
        char err_msg[BUFSZE];
        int handle = -1;
        int ret;
+       bool skip_reference_check = false;
 
        if (!_is_authorized(getuid())) {
                _E("You are not an authorized user!");
                return -1;
        }
 
-       if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_DIR, true) < 0)
+       if (argc > 1 && !strcmp(argv[1], "--skip-reference-check"))
+               skip_reference_check = true;
+
+       if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_DIR, true,
+                               skip_reference_check) < 0)
                goto error;
 
-       if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_DIR, true) < 0)
+       if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_DIR, true,
+                               skip_reference_check) < 0)
                goto error;
 
-       if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_RW_DIR, false) < 0)
+       if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_RW_DIR, false,
+                               skip_reference_check) < 0)
                goto error;
 
-       if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_RW_DIR, false) < 0)
+       if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_RW_DIR, false,
+                               skip_reference_check) < 0)
                goto error;
 
        return 0;