Browse Source

[Improvement][script] Add installPath verification for install.sh (#12523)

3.2.0-release
muggleChen 2 years ago committed by GitHub
parent
commit
72e50b25f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      script/install.sh

6
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

Loading…
Cancel
Save