diff options
author | ho.namkoong <ho.namkoong@samsung.com> | 2014-01-08 15:50:17 +0900 |
---|---|---|
committer | ho.namkoong <ho.namkoong@samsung.com> | 2014-01-08 17:06:06 +0900 |
commit | db18664215cf8f6b78555247e2f82a458bfa8af0 (patch) | |
tree | fdbcae7b4c7a13a6a2944eea391d843c15919a29 | |
parent | 672ad5a51954c74b1f09c699ee82ab73975f4730 (diff) | |
download | sdb-db18664215cf8f6b78555247e2f82a458bfa8af0.tar.gz sdb-db18664215cf8f6b78555247e2f82a458bfa8af0.tar.bz2 sdb-db18664215cf8f6b78555247e2f82a458bfa8af0.zip |
SDB: remove sudo commands when installing sdb
remove tsudo by setting autocomplete in user account
Change-Id: I925f8aeb3a18cb4f54176b967788b9892a7b1305
Signed-off-by: ho.namkoong <ho.namkoong@samsung.com>
-rw-r--r-- | package/.sdb-completion.bash (renamed from package/sdb-autocomplete) | 5 | ||||
-rwxr-xr-x | package/build.linux | 3 | ||||
-rwxr-xr-x | package/sdb-sudocmds | 9 | ||||
-rwxr-xr-x | package/sdb.install.linux | 19 | ||||
-rwxr-xr-x | package/sdb.remove.linux | 3 |
5 files changed, 19 insertions, 20 deletions
diff --git a/package/sdb-autocomplete b/package/.sdb-completion.bash index 634d2a3..e98ad3d 100644 --- a/package/sdb-autocomplete +++ b/package/.sdb-completion.bash @@ -1,7 +1,6 @@ _sdb() { #sdb path is defined in PATH environment variable - SDB_BIN=sdb COMPREPLY=() # cur="${COMP_WORDS[COMP_CWORD]}" ARGS="autocomplete,${COMP_CWORD}" @@ -20,7 +19,9 @@ _sdb() ARGS="${ARGS}${IFS}${convertedarg}" done - next=($(${SDB_BIN} ${ARGS})) + SDB_PATH=$(eval eval echo \$\{COMP_WORDS\[0\]\}) + + next=($("${SDB_PATH}" ${ARGS})) local IFS=$'\n' COMPREPLY=(${next}) # COMPREPLY=($(compgen -W "${next}" -- ${cur})) diff --git a/package/build.linux b/package/build.linux index 8a06d81..3ce5113 100755 --- a/package/build.linux +++ b/package/build.linux @@ -66,8 +66,7 @@ install() then mkdir -p ${INSTALL_DIR}/data/tools cp ${SRCDIR}/bin/* ${INSTALL_DIR}/data/tools/ - cp -f ${SRCDIR}/package/sdb-autocomplete ${INSTALL_DIR}/data/tools/ - cp -f ${SRCDIR}/package/sdb-sudocmds ${INSTALL_DIR}/data/tools/ + cp -f ${SRCDIR}/package/.sdb-completion.bash ${INSTALL_DIR}/data/tools/ fi fi done diff --git a/package/sdb-sudocmds b/package/sdb-sudocmds deleted file mode 100755 index 8ebb00b..0000000 --- a/package/sdb-sudocmds +++ /dev/null @@ -1,9 +0,0 @@ -INSTALLED_PATH=$1 -SDB_AC_NAME=sdb-autocomplete -SDB_AC_SRC_PATH=${INSTALLED_PATH}/tools/${SDB_AC_NAME} -SDB_AC_DST_PATH=/etc/bash_completion.d/${SDB_AC_NAME} -SDB_NAME=sdb -SDB_PATH=${INSTALLED_PATH}/tools/${SDB_NAME} - -mv -f ${SDB_AC_SRC_PATH} ${SDB_AC_DST_PATH} -ln -sf ${SDB_PATH} /usr/bin/sdb diff --git a/package/sdb.install.linux b/package/sdb.install.linux index c87e9e7..5e56579 100755 --- a/package/sdb.install.linux +++ b/package/sdb.install.linux @@ -1,14 +1,23 @@ #!/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=~/.bashrc -if [ -z "${TSUDO}" ]; then - gksudo -m "enable sdb autocomplete" "${INSTALLED_PATH}/tools/sdb-sudocmds ${INSTALLED_PATH}" +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 "\n# Enable programmable sdb completion features.\nsource ~/.sdb/.sdb-completion.bash\n" >> "${BASH_RC}" + fi else - ${TSUDO} -m "enable sdb autocomplete" "${INSTALLED_PATH}/tools/sdb-sudocmds ${INSTALLED_PATH}" + echo -e "\n# Enable programmable sdb completion features.\nsource ~/.sdb/.sdb-completion.bash\n" >> "${BASH_RC}" fi -rm -f ${INSTALLED_PATH}/tools/sdb-sudocmds - # . /etc/bash_completion exit 0 diff --git a/package/sdb.remove.linux b/package/sdb.remove.linux index 4cd75c8..fa1fc1c 100755 --- a/package/sdb.remove.linux +++ b/package/sdb.remove.linux @@ -2,10 +2,9 @@ SDB_PATH=tools/sdb ${INSTALLED_PATH}/${SDB_PATH} kill-server SDB_AC_NAME=sdb-autocomplete -SDB_AC_DST_PATH=/etc/bash_completion.d/${SDB_AC_NAME} rm -rf ${INSTALLED_PATH}/${SDB_PATH} -${TSUDO} "rm -rf ${SDB_AC_DST_PATH} /usr/bin/sdb" +rm -rf ~/.sdb exit 0 |