summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshingil.kang <shingil.kang@samsung.com>2014-03-28 17:31:11 +0900
committershingil.kang <shingil.kang@samsung.com>2014-03-28 17:31:11 +0900
commitb6a5984084230f32b28b9fc81ae8938362b4a00c (patch)
tree4f5c56e0cebea4f5d104c29105f926e305bdab09
parent95ed4da5e7076500083c650c0877bbb76da08b45 (diff)
downloadsdb-b6a5984084230f32b28b9fc81ae8938362b4a00c.tar.gz
sdb-b6a5984084230f32b28b9fc81ae8938362b4a00c.tar.bz2
sdb-b6a5984084230f32b28b9fc81ae8938362b4a00c.zip
SDB: Added sdb auto completion to the install script on Mac OS
Change-Id: Idbb884eb2ca7b952c0f7eec867e948422f30349d Signed-off-by: shingil.kang <shingil.kang@samsung.com>
-rwxr-xr-xpackage/build.macos-641
-rwxr-xr-xpackage/sdb.install.macos-6419
-rwxr-xr-xpackage/sdb.remove.macos-6411
3 files changed, 30 insertions, 1 deletions
diff --git a/package/build.macos-64 b/package/build.macos-64
index 19a7440..55b2a3e 100755
--- a/package/build.macos-64
+++ b/package/build.macos-64
@@ -31,6 +31,7 @@ install()
INSTALL_DIR=${SRCDIR}/package/sdb.package.macos-64
mkdir -p ${INSTALL_DIR}/data/tools
cp -R ${SRCDIR}/bin/* ${INSTALL_DIR}/data/tools/
+ cp -f ${SRCDIR}/package/.sdb-completion.bash ${INSTALL_DIR}/data/tools/
}
[ "$1" = "clean" ] && clean
diff --git a/package/sdb.install.macos-64 b/package/sdb.install.macos-64
index 256b648..8b6f13e 100755
--- a/package/sdb.install.macos-64
+++ b/package/sdb.install.macos-64
@@ -1,3 +1,22 @@
#!/bin/bash -ex
+SDB_AC_NAME=.sdb-completion.bash
+SDB_SETTING_PATH=~/.sdb
+SDB_AC_SRC_PATH=${INSTALLED_PATH}/tools/${SDB_AC_NAME}
+SDB_AC_DST_PATH=${SDB_SETTING_PATH}/${SDB_AC_NAME}
+BASH_RC=~/.profile
+ENABLE_SDB_COMPLETION="# Enable programmable sdb completion features.\nif [ -f ~/.sdb/.sdb-completion.bash ]; then\n source ~/.sdb/.sdb-completion.bash\nfi"
+
+rm -rf ${SDB_SETTING_PATH}
+mkdir -p ${SDB_SETTING_PATH}
+mv -f ${SDB_AC_SRC_PATH} ${SDB_AC_DST_PATH}
+
+if [ -f "${BASH_RC}" ]; then
+ if [ -z $(grep "source ~/\.sdb/\.sdb-completion\.bash" "${BASH_RC}") ]; then
+ echo -e $ENABLE_SDB_COMPLETION >> "${BASH_RC}"
+ fi
+else
+ echo -e $SDB_ENABLE_COMPLETION >> "${BASH_RC}"
+fi
+
exit 0
diff --git a/package/sdb.remove.macos-64 b/package/sdb.remove.macos-64
index 10a8dda..e71e321 100755
--- a/package/sdb.remove.macos-64
+++ b/package/sdb.remove.macos-64
@@ -1,6 +1,15 @@
#!/bin/bash -ex
SDB_PATH=tools/sdb
-${INSTALLED_PATH}/${SDB_PATH} kill-server
+BASH_RC=~/.profile
+
+if [ -f ${INSTALLED_PATH}/${SDB_PATH} ]; then
+ ${INSTALLED_PATH}/${SDB_PATH} kill-server
+fi
+
rm -rf ${INSTALLED_PATH}/${SDB_PATH}
+rm -rf ~/.sdb
+if [ -f ${BASH_RC} ]; then
+ sed -i -E '/# Enable programmable sdb completion features/,/fi/d' ${BASH_RC}
+fi
exit 0