You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/05/25 13:52:21 UTC

[dolphinscheduler] branch dev updated: [fix][deploy] File overwrite when specific value set to installPath (#10241)

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

zhongjiajie 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 117082154d [fix][deploy] File overwrite when specific value set to installPath (#10241)
117082154d is described below

commit 117082154d95f0b66781fc1a8ba4e61cd7444d00
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Wed May 25 21:52:14 2022 +0800

    [fix][deploy] File overwrite when specific value set to installPath (#10241)
    
    When our `installPath` in file `install_env.sh` set to `/`
    or empty or related path to `/` some system specific directory
    , like `/bin` and `libs`, will be overwritten, and it is not expected
---
 script/install.sh   | 6 ++++++
 script/scp-hosts.sh | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/script/install.sh b/script/install.sh
index 16be44591d..dcde12ad88 100755
--- a/script/install.sh
+++ b/script/install.sh
@@ -24,9 +24,15 @@ source ${workDir}/env/dolphinscheduler_env.sh
 
 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
   sudo mkdir -p $installPath
   sudo chown -R $deployUser:$deployUser $installPath
+elif [[ -z "${installPath// }" || "${installPath// }" == "/" || ( $(command -v realpath) && $(realpath -s "${installPath}") == "/" ) ]]; then
+  echo "Parameter installPath can not be empty, use in root path or related path of root path, currently use ${installPath}"
+  exit 1
 fi
 
 echo "2.scp resources"
diff --git a/script/scp-hosts.sh b/script/scp-hosts.sh
index 5ac51de8ed..25b688170a 100755
--- a/script/scp-hosts.sh
+++ b/script/scp-hosts.sh
@@ -40,8 +40,6 @@ do
   fi
 
   echo "scp dirs to $host/$installPath starting"
-	ssh -p $sshPort $host  "cd $installPath/; rm -rf bin/ master-server/ worker-server/ alert-server/ api-server/ ui/ tools/"
-
   for i in ${!workerNames[@]}; do
     if [[ ${workerNames[$i]} == $host ]]; then
       workerIndex=$i