summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshingil.kang <shingil.kang@samsung.com>2014-03-27 22:08:52 +0900
committershingil.kang <shingil.kang@samsung.com>2014-03-27 22:13:33 +0900
commit95ed4da5e7076500083c650c0877bbb76da08b45 (patch)
treeb24b9e50b1668f4a7b37bf54d831d1f2bbd6a719
parent8ead476e3365c65d2629de114e30864b0443a023 (diff)
downloadsdb-95ed4da5e7076500083c650c0877bbb76da08b45.tar.gz
sdb-95ed4da5e7076500083c650c0877bbb76da08b45.tar.bz2
sdb-95ed4da5e7076500083c650c0877bbb76da08b45.zip
SDB: Check if sdb completion script exists when applying sdb completion.
Change-Id: I36f7bc71fc42f811008e6dae572b73c198cbc9a7 Signed-off-by: shingil.kang <shingil.kang@samsung.com>
-rwxr-xr-xpackage/sdb.install.linux7
-rwxr-xr-xpackage/sdb.remove.linux4
2 files changed, 5 insertions, 6 deletions
diff --git a/package/sdb.install.linux b/package/sdb.install.linux
index 6ebec65..6deb1ef 100755
--- a/package/sdb.install.linux
+++ b/package/sdb.install.linux
@@ -5,6 +5,7 @@ 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=~/.bashrc
+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}
@@ -12,12 +13,10 @@ 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 programmable sdb completion features.\nsource ~/.sdb/.sdb-completion.bash\n" >> "${BASH_RC}"
+ echo -e $ENABLE_SDB_COMPLETION >> "${BASH_RC}"
fi
else
- echo -e "# Enable programmable sdb completion features.\nsource ~/.sdb/.sdb-completion.bash\n" >> "${BASH_RC}"
+ echo -e $SDB_ENABLE_COMPLETION >> "${BASH_RC}"
fi
-# . /etc/bash_completion
-
exit 0
diff --git a/package/sdb.remove.linux b/package/sdb.remove.linux
index 306a5b4..302ad4b 100755
--- a/package/sdb.remove.linux
+++ b/package/sdb.remove.linux
@@ -1,5 +1,6 @@
#!/bin/bash -ex
SDB_PATH=tools/sdb
+
if [ -f ${INSTALLED_PATH}/${SDB_PATH}]; then
${INSTALLED_PATH}/${SDB_PATH} kill-server
fi
@@ -7,8 +8,7 @@ fi
rm -rf ${INSTALLED_PATH}/${SDB_PATH}
rm -rf ~/.sdb
if [ -f ~/.bashrc ]; then
- sed -i -E '/# Enable programmable sdb completion features\.|source ~\/\.sdb\/\.sdb-completion\.bash/d' ~/.bashrc
+ sed -i -E '/# Enable programmable sdb completion features/,/fi/d' ~/.bashrc
fi
exit 0
-