summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshingil.kang <shingil.kang@samsung.com>2014-04-13 16:19:18 +0900
committershingil.kang <shingil.kang@samsung.com>2014-04-21 13:44:09 +0900
commit5cf6b9e4bdca65e2ca450a3d9df030e510da6124 (patch)
treeae659b55b09525cd6d7c8c38a493e00b92c10834
parent58bbfa807216b2c571989fca7bff5411a7075f5c (diff)
downloadsdb-5cf6b9e4bdca65e2ca450a3d9df030e510da6124.tar.gz
sdb-5cf6b9e4bdca65e2ca450a3d9df030e510da6124.tar.bz2
sdb-5cf6b9e4bdca65e2ca450a3d9df030e510da6124.zip
SDB: Get application temporary path by using pkgcmd when installing tizen package
Change-Id: Iee5cb5ae1d782c2bdd2d4e64b6f9df42ca435a66 Signed-off-by: shingil.kang <shingil.kang@samsung.com>
-rw-r--r--src/command_function.c30
-rw-r--r--src/sdb_constants.c1
2 files changed, 28 insertions, 3 deletions
diff --git a/src/command_function.c b/src/command_function.c
index f1c26cf..055b30a 100644
--- a/src/command_function.c
+++ b/src/command_function.c
@@ -51,6 +51,7 @@ static int get_pkgtype_file_name(const char* file_name);
static int get_pkgtype_from_app_id(const char* app_id);
static int kill_gdbserver_if_running(const char* process_cmd);
static int verify_gdbserver_exist();
+static int get_pkg_tmp_dir(char* pkg_tmp_dir);
int da(int argc, char ** argv) {
char full_cmd[PATH_MAX] = "shell:/usr/bin/da_command";
@@ -547,12 +548,13 @@ int forkserver(int argc, char** argv) {
}
int install(int argc, char **argv) {
-
char* srcpath = argv[1];
const char* filename = sdb_dirstop(srcpath);
char destination[PATH_MAX];
- snprintf(destination, PATH_MAX, "%s", DIR_APP_TMP );
+ if(get_pkg_tmp_dir(destination) < 0) {
+ return 1;
+ }
if (filename) {
filename++;
@@ -631,6 +633,30 @@ int uninstall(int argc, char **argv) {
return 0;
}
+// Get the package temporary path. Returns minus if exception happens.
+static int get_pkg_tmp_dir(char* pkg_tmp_dir){
+
+ char buf[512] = {};
+
+ const char* SHELL_GET_PKG_TMP_DIR_CMD ="shell:/usr/bin/pkgcmd -a | head -1 | awk '{print $5}'";
+ int fd = sdb_connect(SHELL_GET_PKG_TMP_DIR_CMD);
+
+ if(fd < 0) {
+ return -1;
+ }
+ if (read_line(fd, buf, sizeof(buf)) > 0) {
+ D("package dir = %s\n", buf);
+ append_file(pkg_tmp_dir, buf, "\/tmp\/", PATH_MAX);
+ D("package tmp dir = %s\n", pkg_tmp_dir);
+ sdb_close(fd);
+ return 0;
+ }
+
+ fprintf(stderr, "failed to get package temporary path : %s", buf);
+ sdb_close(fd);
+ return -1;
+}
+
// Returns 0 if pkg type is wgt. Returns 1 if pkg type is tpk. Returns minus if exception happens.
static int get_pkgtype_file_name(const char* file_name) {
diff --git a/src/sdb_constants.c b/src/sdb_constants.c
index fa735e5..13a181e 100644
--- a/src/sdb_constants.c
+++ b/src/sdb_constants.c
@@ -31,7 +31,6 @@
const char* EMPTY_STRING = "";
const char* WHITE_SPACE = " ";
- const char* DIR_APP_TMP = "/opt/usr/apps/tmp/";
const char* QUOTE_CHAR = " \"\\()";
const char* PREFIX_HOST = "host:";