diff --git a/install_wolf.sh b/install_wolf.sh index 3eda7cbce5d9655781eea4c4f637f477bedddbf5..2cedc4c0d398e0c2008861a764d98820b651bbf1 100755 --- a/install_wolf.sh +++ b/install_wolf.sh @@ -35,6 +35,11 @@ func_check_yn () { fi } +# START ##################################################### +CORES=$(nproc) +func_echo "The number of available cores on this machine is $CORES" +RUN_PATH=$PWD + ## OPTIONS ##################################################### VERBOSE="true" INSTALL_PLUGINS="" @@ -103,9 +108,21 @@ while getopts "vap:d:w:hf:c:" opt; do ;; d) # deps path DEPS_PATH=$OPTARG + if cd $DEPS_PATH ; then + func_echo "Valid dependency path." + else + echo "Invalid dependency path." + exit 1 + fi ;; w) # wolf path WOLF_PATH=$OPTARG + if cd $WOLF_PATH ; then + func_echo "Valid wolf folder path." + else + echo "Invalid wolf folder path." + exit 1 + fi ;; h ) usage @@ -123,10 +140,6 @@ while getopts "vap:d:w:hf:c:" opt; do esac done -# START ##################################################### -CORES=$(nproc) -func_echo "The number of available cores on this machine is $CORES" -RUN_PATH=$PWD # UBUNTU if [ "$UID" -eq 0 -o "$EUID" -eq 0 ]; then @@ -148,12 +161,16 @@ fi # WOLF DEPENDENCIES ##################################################### +cd $RUN_PATH func_echo "You are in folder $PWD" if [ $DEPS_PATH == "undefined" ]; then echo "Enter path for dependencies (either /global/path or relative/path):" read DEPS_PATH fi -cd $DEPS_PATH +while ! cd $DEPS_PATH ; do + echo "Invalid dependency path. Enter path for dependencies (either /global/path or relative/path):" + read DEPS_PATH +done DEPS_PATH=$PWD func_echo "path dependencies: $DEPS_PATH" @@ -227,7 +244,10 @@ if [ $WOLF_PATH == "undefined" ]; then echo "Enter path for wolf folder (either /global/path or relative/path):" read WOLF_PATH fi -cd $WOLF_PATH +while ! cd $WOLF_PATH ; do + echo "Invalid dependency path. Enter path for dependencies (either /global/path or relative/path):" + read WOLF_PATH +done mkdir wolf cd wolf WOLF_PATH=$PWD