Browse Source

[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
3.1.0-release
Jiajie Zhong 3 years ago committed by GitHub
parent
commit
117082154d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      script/install.sh
  2. 2
      script/scp-hosts.sh

6
script/install.sh

@ -24,9 +24,15 @@ source ${workDir}/env/dolphinscheduler_env.sh
echo "1.create directory" 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 [ ! -d $installPath ];then
sudo mkdir -p $installPath sudo mkdir -p $installPath
sudo chown -R $deployUser:$deployUser $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 fi
echo "2.scp resources" echo "2.scp resources"

2
script/scp-hosts.sh

@ -40,8 +40,6 @@ do
fi fi
echo "scp dirs to $host/$installPath starting" 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 for i in ${!workerNames[@]}; do
if [[ ${workerNames[$i]} == $host ]]; then if [[ ${workerNames[$i]} == $host ]]; then
workerIndex=$i workerIndex=$i

Loading…
Cancel
Save