[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 117082154d)
This commit is contained in:
parent
f5277570f0
commit
51c6630296
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue