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 15:45:10 UTC

[dolphinscheduler] 07/08: [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 3.0.0-beta-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit 51c6630296dfadc55d0b5f1a5dc25d05aea0212c
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
    
    (cherry picked from commit 117082154d95f0b66781fc1a8ba4e61cd7444d00)
---
 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