[Improvement][script] Add installPath verification for install.sh (#12523)
This commit is contained in:
parent
641a2559ea
commit
72e50b25f1
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
workDir=`dirname $0`
|
workDir=`dirname $0`
|
||||||
workDir=`cd ${workDir};pwd`
|
workDir=`cd ${workDir};pwd`
|
||||||
|
baseDir=`cd ${workDir}/..;pwd`
|
||||||
|
|
||||||
source ${workDir}/env/install_env.sh
|
source ${workDir}/env/install_env.sh
|
||||||
source ${workDir}/env/dolphinscheduler_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,
|
# 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
|
# 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`.
|
# 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 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
|
elif [[ -z "${installPath// }" || "${installPath// }" == "/" || ( $(command -v realpath) && $(realpath -s "${installPath}") == "/" ) ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue