+* 2.2.14
+- Change PATH_MAX in Windows 256 -> 4096
+== ho.namkoong <ho.namkoong@samsung.com> 2013-07-11
+* 2.2.13
+- echo stdout in install script
+== ho.namkoong <ho.namkoong@samsung.com> 2013-07-11
+* 2.2.12
+- use tsudo instead of gksudo
+== ho.namkoong <ho.namkoong@samsung.com> 2013-07-11
+* 2.2.11
+- Fixed sdbd version checking without rpm query
+== ho.namkoong <ho.namkoong@samsung.com> 2013-07-08
+* 2.2.10
+- Fixed argument append util for da/oprofile command
+== kh5325.kim <kh5325.kim@samsung.com> 2013-07-08
* 2.2.9
- Fix pull/push message
== ho.namkoong <ho.namkoong@samsung.com> 2013-07-04
-Version:2.2.9
+Version:2.2.14
Source:sdb
Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park<yoonki.park@samsung.com>, Hyunsik Noh<hyunsik.noh@samsung.com>, Gun Kim<gune.kim@samsung.com>, Ho Namkoong<ho.namkoong@samsung.com>, Taeyoung Son<taeyoung2.son@samsung.com>
+++ /dev/null
-#!/bin/bash -x
-
-## Set sdb's environment path
-s=`cat ${HOME}/.bashrc | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
-
-if [ "x${s}" = "x" ] ; then
- cat >> ${HOME}/.bashrc << END
-## Tizen SDK configuration
-# This is generated by Tizen SDK. Please do not modify by yourself.
-# Set sdb environment path
-export PATH=\$PATH:${INSTALLED_PATH}/tools
-## End Tizen SDK configuration
-END
-fi
-
-source ${HOME}/.bashrc
-
-exit 0
-#!/bin/bash -x
+#!/bin/bash -ex
## Set sdb's environment path
-s=`cat ${HOME}/.bashrc | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
+bashrc=${HOME}/.bashrc
+if [ -f ${bashrc} ]; then
+ s=`cat ${bashrc} | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
+else
+ s=
+fi
-if [ "x${s}" = "x" ] ; then
- cat >> ${HOME}/.bashrc << END
+if [ "x${s}" = "x" ]; then
+cat >> ${bashrc} << END
## Tizen SDK configuration
# This is generated by Tizen SDK. Please do not modify by yourself.
# Set sdb environment path
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"04e8\", ATTRS{idProduct}==\"6864\", MODE=\"0666\", GROUP=\"plugdev\"" >> $TMP_FILE
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"04e8\", ATTRS{idProduct}==\"6863\", MODE=\"0666\", GROUP=\"plugdev\"" >> $TMP_FILE
chmod +x $TMP_FILE
-if [ -f /usr/bin/gksudo ]
- then gksudo mv ${TMP_FILE} /etc/udev/rules.d/
- else if [ -f /usr/bin/sudo ]
- then sudo mv ${TMP_FILE} /etc/udev/rules.d/
+
+if [ -z "$TSUDO" ]; then
+ if [ -f /usr/bin/gksudo ]
+ then gksudo mv ${TMP_FILE} /etc/udev/rules.d/
+ else if [ -f /usr/bin/sudo ]
+ then sudo mv ${TMP_FILE} /etc/udev/rules.d/
+ fi
fi
+ exit 0
+else
+ $TSUDO -m "Enter your password to install sdb." mv ${TMP_FILE} /etc/udev/rules.d/
+ exit 0
fi
exit 0
--- /dev/null
+#!/bin/bash -ex
+
+## Set sdb's environment path
+
+bashrc=${HOME}/.bashrc
+if [ -f ${bashrc} ]; then
+ s=`cat ${bashrc} | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
+else
+ s=
+fi
+
+if [ "x${s}" = "x" ]; then
+cat >> ${bashrc} << END
+## Tizen SDK configuration
+# This is generated by Tizen SDK. Please do not modify by yourself.
+# Set sdb environment path
+export PATH=\$PATH:${INSTALLED_PATH}/tools
+## End Tizen SDK configuration
+END
+fi
+
+source ${HOME}/.bashrc
+
+exit 0
--- /dev/null
+@echo off
+
+echo "setting path..."
+setx -m PATH "%PATH%;${INSTALLED_PATH}\tools
+exit 0
+++ /dev/null
-#!/bin/sh
-SDB_PATH=tools/sdb
-${INSTALLED_PATH}/${SDB_PATH} kill-server
-rm -rf ${INSTALLED_PATH}/${SDB_PATH}
-## remove sdb environment path
-s=`cat ${HOME}/.bashrc | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
-
-if [ "x${s}" = "x" ] ; then
- exit 1
-fi
-
-if [ ${s} -ge 0 ] ; then
- e=`cat ${HOME}/.bashrc | grep -n "## End Tizen SDK configuration" | cut -f1 -d":"`
- if [ $e -ge $s ] ; then
- cp ${HOME}/.bashrc ${HOME}/.bashrc.tizen
- sed "${s},${e}d" ${HOME}/.bashrc > ${HOME}/.bashrc.swap
- mv ${HOME}/.bashrc.swap ${HOME}/.bashrc
- source ${HOME}/.bashrc
- fi
-fi
-
-exit 0
-#!/bin/sh
+#!/bin/bash -ex
SDB_PATH=tools/sdb
${INSTALLED_PATH}/${SDB_PATH} kill-server
rm -rf ${INSTALLED_PATH}/${SDB_PATH}
fi
## remove udev rule file
-gksudo rm -rf /etc/udev/rules.d/99-samsung-device.rules
+
+if [ -z "$TSUDO" ]; then
+ if [ -f /usr/bin/gksudo ]
+ then gksudo rm -rf /etc/udev/rules.d/99-samsung-device.rules
+ else if [ -f /usr/bin/sudo ]
+ then sudo rm -rf /etc/udev/rules.d/99-samsung-device.rules
+ fi
+ fi
+ exit 0
+else
+ $TSUDO -m "Enter your password to uninstall sdb." rm -rf /etc/udev/rules.d/99-samsung-device.rules
+ exit 0
+fi
exit 0
--- /dev/null
+#!/bin/bash -ex
+SDB_PATH=tools/sdb
+${INSTALLED_PATH}/${SDB_PATH} kill-server
+rm -rf ${INSTALLED_PATH}/${SDB_PATH}
+## remove sdb environment path
+s=`cat ${HOME}/.bashrc | grep -n "## Tizen SDK configuration" | cut -f1 -d":"`
+
+if [ "x${s}" = "x" ] ; then
+ exit 1
+fi
+
+if [ ${s} -ge 0 ] ; then
+ e=`cat ${HOME}/.bashrc | grep -n "## End Tizen SDK configuration" | cut -f1 -d":"`
+ if [ $e -ge $s ] ; then
+ cp ${HOME}/.bashrc ${HOME}/.bashrc.tizen
+ sed "${s},${e}d" ${HOME}/.bashrc > ${HOME}/.bashrc.swap
+ mv ${HOME}/.bashrc.swap ${HOME}/.bashrc
+ source ${HOME}/.bashrc
+ fi
+fi
+
+exit 0
set execute_path=tools
%INSTALLED_PATH%\%execute_path%\sdb.exe kill-server
del %INSTALLED_PATH%\%execute_path%\sdb.exe
-del %INSTALLED_PATH%\%execute_path%\SdbWinApi.dll
-del %INSTALLED_PATH%\%execute_path%\SdbWinUsbApi.dll
del %INSTALLED_PATH%\%execute_path%\ansicon.exe
del %INSTALLED_PATH%\%execute_path%\ANSI32.dll
exit 0
#define TRACE_TAG TRACE_SDB
+#ifdef OS_WINDOWS
+#define PATH_MAX 4096
+#endif
+
+
int da(int argc, char ** argv, void** extargv);
int oprofile(int argc, char ** argv, void** extargv);
int launch(int argc, char ** argv, void** extargv);
#include "file_sync_functions.h"
#include "utils.h"
#include "strutils.h"
+#include "fdevent.h"
+#include "sdb.h"
static __inline__ void finalize(int srcfd, int dstfd, FILE_FUNC* srcF, FILE_FUNC* dstF);
}
static int file_copy(int src_fd, int dst_fd, char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, unsigned* total_bytes) {
+ D("file is copied from 'fd:%d' '%s' to 'fd:%d' '%s'\n", src_fd, srcp, dst_fd, dstp);
void* srcstat;
if(srcF->_stat(src_fd, srcp, &srcstat, 1) < 0) {
return -1;
int do_sync_copy(char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, int is_utf8, void** ext_argv) {
+ D("copy %s to the %s\n", srcp, dstp);
unsigned total_bytes = 0;
long long start_time = NOW();
return 1;
}
int src_dir = srcF->is_dir(srcp, srcstat, 1);
- int dst_dir = 1;
+ int dst_dir = 0;
if(dstF->_stat(dst_fd, dstp, &dststat, 0) >= 0) {
dst_dir = dstF->is_dir(dstp, dststat, 0);
}
+ else {
+ int dst_len = strlen(dstp);
+ if( dstp[dst_len - 1] == '/' || dstp[dst_len - 1] == '\\') {
+ dst_dir = 1;
+ }
+ }
free(dststat);
free(srcstat);
if(src_dir == -1 || dst_dir == -1) {
finalize(src_fd, dst_fd, srcF, dstF);
return 1;
}
- //copy file
- else if(src_dir == 0) {
+ if(src_dir == 0) {
/* if we're copying a local file to a remote directory,
** we *really* want to copy to remotedir + "/" + localfilename
*/
#include "sdb_client.h"
#include "file_sync_functions.h"
#include "linkedlist.h"
-
#include "strutils.h"
#include "file_sync_client.h"
//return > 0 fd, = 0 success, < 0 fail.
int initialize_local(char* path, void** extargv) {
+ D("initialize local file '%s'", path);
return 0;
}
//return fd
int initialize_remote(char* path, void** extargv) {
+ D("initialize remote file '%s'", path);
int fd = sdb_connect("sync:", extargv);
if(fd < 0) {
}
void finalize_local(int fd) {
-
+ D("finalize local fd '%d'", fd);
}
void finalize_remote(int fd) {
+ D("finalize remote fd '%d'", fd);
syncmsg msg;
msg.req.id = ID_QUIT;
//TODO stat should be freed.
int _stat_local(int fd, char* path, void** _stat, int show_error) {
+ D("stat local file 'fd:%d' '%s'", fd, path);
struct stat* st = (struct stat*)malloc(sizeof(struct stat));
if(stat(path, st)) {
if(show_error) {
int _stat_remote(int fd, char* path, void** stat, int show_error) {
+ D("stat remote file 'fd:%d' '%s'", fd, path);
unsigned* mode = (unsigned*)malloc(sizeof(unsigned));
if(sync_readmode(fd, path, mode)) {
if(show_error) {
//return fd.
int readopen_local(int fd, char* srcp, void* srcstat) {
+ D("read open local file 'fd:%d' '%s'", fd, srcp);
struct stat* st = srcstat;
if(S_ISREG(st->st_mode)) {
fd = sdb_open(srcp, O_RDONLY);
}
int readopen_remote(int fd, char* srcp, void* srcstat) {
+ D("read open remote file 'fd:%d' '%s'", fd, srcp);
syncmsg msg;
int len;
}
int readclose_local(int lfd) {
+ D("read close local file 'fd:%d'", lfd);
if(lfd > 0) {
sdb_close(lfd);
}
}
int readclose_remote(int fd) {
+ D("read close remote file 'fd:%d'", fd);
return fd;
}
int writeopen_local(int fd, char* dstp, void* stat) {
+ D("write open local file 'fd:%d' '%s'", fd, dstp);
sdb_unlink(dstp);
mkdirs(dstp);
fd = sdb_creat(dstp, 0644);
//return fd.
int writeopen_remote(int fd, char* dstp, void* stat) {
+ D("write open remote file 'fd:%d' '%s'", fd, dstp);
syncmsg msg;
struct stat* st = (struct stat*)stat;
}
int writeclose_local(int fd, char*dstp, void* stat) {
+ D("write close local file 'fd:%d' '%s'", fd, dstp);
if(fd > 0) {
sdb_close(fd);
}
}
int writeclose_remote(int fd, char* dstp, void* stat) {
+ D("write close remote file 'fd:%d' '%s'", fd, dstp);
struct stat* st = (struct stat*)stat;
syncmsg msg;
msg.data.id = ID_DONE;
//1: write and continue load
//3: write and stop
int readfile_local(int lfd, char* srcpath, void* stat, FILE_BUFFER* sbuf) {
+ D("read local file 'fd:%d' '%s'", lfd, srcpath);
struct stat* st = (struct stat*)stat;
if (S_ISREG(st->st_mode)) {
}
int readfile_remote(int fd, char* srcpath, void* stat, FILE_BUFFER* buffer) {
+ D("read remote file 'fd:%d' '%s'", fd, srcpath);
syncmsg msg;
unsigned id;
}
int writefile_local(int fd, char* dstp, FILE_BUFFER* sbuf, unsigned* total_bytes) {
+ D("write local file 'fd:%d' '%s'", fd, dstp);
char* data = sbuf->data;
unsigned len = sbuf->size;
}
int writefile_remote(int fd, char* dstp, FILE_BUFFER* sbuf, unsigned* total_bytes) {
+ D("write remote file 'fd:%d' '%s'", fd, dstp);
int size = ltohl(sbuf->size);
if(writex(fd, sbuf, sizeof(unsigned)*2 + size)) {
}
int getdirlist_local(int fd, char* src_dir, char* dst_dir, LIST_NODE** dirlist) {
+ D("get list of local file 'fd:%d' '%s'", fd, src_dir);
DIR* d;
d = opendir(src_dir);
}
int getdirlist_remote(int fd, char* src_dir, char* dst_dir, LIST_NODE** dirlist) {
+ D("get list of remote file 'fd:%d' '%s'", fd, src_dir);
syncmsg msg;
int len;
#ifndef FILE_SYNC_FUNCTIONS_H_
#define FILE_SYNC_FUNCTIONS_H_
+#define TRACE_TAG TRACE_SDB
+
#include "file_sync_service.h"
#include "linkedlist.h"
return 0;
}
+int sdk_launch_exist(void* extargv) {
+ const char* SDK_LAUNCH_QUERY = "shell:ls /usr/sbin/sdk_launch";
+ D("query the existence of sdk_launch\n");
+ int fd = sdb_connect(SDK_LAUNCH_QUERY, extargv);
+
+ if(fd < 0) {
+ D("fail to query the sdbd version\n");
+ return fd;
+ }
+
+ char query_result[PATH_MAX];
+ char* result_ptr = query_result;
+ int max_len = PATH_MAX;
+ int len;
+
+ while(fd >= 0) {
+ len = sdb_read(fd, result_ptr, max_len);
+ if(len == 0) {
+ break;
+ }
+
+ if(len < 0) {
+ if(errno == EINTR) {
+ continue;
+ }
+ break;
+ }
+ max_len -= len;
+ result_ptr += len;
+ fflush(stdout);
+ }
+
+ const char* expected_result = "/usr/sbin/sdk_launch";
+
+ if(!strncmp(expected_result, query_result, sizeof(expected_result))) {
+ return 1;
+ }
+ return 0;
+}
+
int sdb_higher_ver(int first, int middle, int last, void* extargv) {
const char* VERSION_QUERY = "shell:rpm -q sdbd";
}
char ver[PATH_MAX];
+ int max_len = PATH_MAX;
+ char* result_ptr = ver;
int len;
D("read sdb version\n");
while(fd >= 0) {
- len = sdb_read(fd, ver, PATH_MAX);
+ len = sdb_read(fd, result_ptr, max_len);
if(len == 0) {
break;
}
if(len < 0) {
- if(errno == EINTR) continue;
+ if(errno == EINTR) {
+ continue;
+ }
break;
}
+ max_len -= len;
+ result_ptr += len;
fflush(stdout);
}
#include "sdb_constants.h"
// debug launch pad is applied after sdbd 2.2.3
-#define SDB_HIGHER_THAN_2_2_3(extargv) sdb_higher_ver(2, 2, 3, extargv)
+#define SDB_HIGHER_THAN_2_2_3(extargv) sdk_launch_exist(extargv)
/* connect to sdb, connect to the named service, and return
** a valid fd for interacting with that service upon success
*/
int sdb_higher_ver(int first, int middle, int last, void* extargv);
+/**
+ * check /usr/sbin/sdk_launch exists in the target.
+ * /usr/sbin/sdk_launch is included higher than sdbd 2.2.4
+ * returns true, if sdbd contains it.
+ * else, returns false.
+ */
+int sdk_launch_exist(void* extargv);
+
/* read a standard sdb status response (OKAY|FAIL) and
** return 0 in the event of OKAY, -1 in the event of FAIL
** or protocol error