Check and make bin directory for ug packages 97/48097/3 tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/mobile/20150914.123622 accepted/tizen/tv/20150914.123635 accepted/tizen/wearable/20150914.123645 submit/tizen/20150914.121938 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 14 Sep 2015 09:56:51 +0000 (18:56 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 14 Sep 2015 10:00:19 +0000 (19:00 +0900)
Change-Id: Ic6a37a1bc5291d8bdc2a2f60a4b31d3a08324ead
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
tool/pkg_install_ug.c

index 37d2bbd..66d2013 100644 (file)
@@ -3,6 +3,8 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/stat.h>
+#include <linux/limits.h>
 
 #include <pkgmgr_parser.h>
 #include <tzplatform_config.h>
 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
 #define UG_CLIENT tzplatform_mkpath(TZ_SYS_BIN, "ug-client")
 
-static int _install_ug(const char *manifest)
+static int _check_bin_directory(const char *pkgid)
+{
+       const char *path;
+       char buf[PATH_MAX];
+
+       path = tzplatform_mkpath(TZ_SYS_RO_APP, pkgid);
+       snprintf(buf, sizeof(buf), "%s/bin", path);
+
+       if (access(buf, F_OK) == 0)
+               return 0;
+
+       if (mkdir(buf, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH)) {
+               printf("create bin directory(%s) failed: %s\n", buf,
+                               strerror(errno));
+               return -1;
+       }
+
+       return 0;
+}
+
+static int _install_ug(char *manifest)
 {
        manifest_x *mfx;
        uiapplication_x *tmp;
@@ -28,6 +50,9 @@ static int _install_ug(const char *manifest)
                                strcasecmp(tmp->ui_gadget, "true") != 0)
                        continue;
 
+               if (_check_bin_directory(mfx->package))
+                       continue;
+
                ret = symlink(UG_CLIENT, tmp->exec);
                if (ret != 0)
                        printf("failed to install ug %s: %s\n", tmp->exec,