You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ch...@apache.org on 2022/11/09 03:50:17 UTC

[dolphinscheduler] branch dev updated: [Improvement][script] Add installPath verification for install.sh (#12523)

This is an automated email from the ASF dual-hosted git repository.

chufenggao pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 72e50b25f1 [Improvement][script] Add installPath verification for install.sh (#12523)
72e50b25f1 is described below

commit 72e50b25f1eac15e5a9041c9cae0b7c57aca496e
Author: muggleChen <c7...@163.com>
AuthorDate: Wed Nov 9 11:50:11 2022 +0800

    [Improvement][script] Add installPath verification for install.sh (#12523)
---
 script/install.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/script/install.sh b/script/install.sh
index dcde12ad88..d36f90a3f3 100755
--- a/script/install.sh
+++ b/script/install.sh
@@ -18,6 +18,7 @@
 
 workDir=`dirname $0`
 workDir=`cd ${workDir};pwd`
+baseDir=`cd ${workDir}/..;pwd`
 
 source ${workDir}/env/install_env.sh
 source ${workDir}/env/dolphinscheduler_env.sh
@@ -27,7 +28,10 @@ echo "1.create directory"
 # If install Path equal to "/" or related path is "/" or is empty, will cause directory "/bin" be overwrite or file adding,
 # so we should check its value. Here use command `realpath` to get the related path, and it will skip if your shell env
 # without command `realpath`.
-if [ ! -d $installPath ];then
+if [ ${baseDir} = $installPath ]; then
+  echo "Fatal: The installPath can not be same as the current path: ${installPath}"
+  exit 1
+elif [ ! -d $installPath ];then
   sudo mkdir -p $installPath
   sudo chown -R $deployUser:$deployUser $installPath
 elif [[ -z "${installPath// }" || "${installPath// }" == "/" || ( $(command -v realpath) && $(realpath -s "${installPath}") == "/" ) ]]; then