summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorho.namkoong <ho.namkoong@samsung.com>2014-01-08 13:48:11 +0900
committerho.namkoong <ho.namkoong@samsung.com>2014-01-08 13:50:01 +0900
commitd27f57c09017ba31554d6aa0ee938698f6f7072d (patch)
tree3ca85fa085a0bab0996b8cb15dfa96a444ca4b8f
parent8b3518d0831e3101073c6883fcd0d73838ba34f8 (diff)
downloadsdb-d27f57c09017ba31554d6aa0ee938698f6f7072d.tar.gz
sdb-d27f57c09017ba31554d6aa0ee938698f6f7072d.tar.bz2
sdb-d27f57c09017ba31554d6aa0ee938698f6f7072d.zip
SDB: run sudo once when install sdb
make script for commands which need root account Change-Id: Ief15a28d66f6e2b3d4a7b1782197469513a582bb Signed-off-by: ho.namkoong <ho.namkoong@samsung.com>
-rwxr-xr-xpackage/build.linux1
-rwxr-xr-xpackage/sdb-sudocmds9
-rwxr-xr-xpackage/sdb.install.linux16
3 files changed, 18 insertions, 8 deletions
diff --git a/package/build.linux b/package/build.linux
index de7b2be..8a06d81 100755
--- a/package/build.linux
+++ b/package/build.linux
@@ -67,6 +67,7 @@ install()
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/
fi
fi
done
diff --git a/package/sdb-sudocmds b/package/sdb-sudocmds
new file mode 100755
index 0000000..8ebb00b
--- /dev/null
+++ b/package/sdb-sudocmds
@@ -0,0 +1,9 @@
+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 f58df21..c87e9e7 100755
--- a/package/sdb.install.linux
+++ b/package/sdb.install.linux
@@ -1,13 +1,13 @@
#!/bin/bash -ex
-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}
-
-${TSUDO} "mv -f ${SDB_AC_SRC_PATH} ${SDB_AC_DST_PATH}"
-${TSUDO} "ln -sf ${SDB_PATH} /usr/bin/sdb"
+
+if [ -z "${TSUDO}" ]; then
+ gksudo -m "enable sdb autocomplete" "${INSTALLED_PATH}/tools/sdb-sudocmds ${INSTALLED_PATH}"
+else
+ ${TSUDO} -m "enable sdb autocomplete" "${INSTALLED_PATH}/tools/sdb-sudocmds ${INSTALLED_PATH}"
+fi
+
+rm -f ${INSTALLED_PATH}/tools/sdb-sudocmds
# . /etc/bash_completion