diff --git a/script/install.sh b/script/install.sh index dcde12ad88..d36f90a3f3 100755 --- a/script/install.sh +++ b/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