Skip to content
Snippets Groups Projects
Commit b0353721 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

checking for valid paths

parent 42e2dc12
No related branches found
No related tags found
No related merge requests found
Pipeline #8655 failed
...@@ -35,6 +35,11 @@ func_check_yn () { ...@@ -35,6 +35,11 @@ func_check_yn () {
fi fi
} }
# START #####################################################
CORES=$(nproc)
func_echo "The number of available cores on this machine is $CORES"
RUN_PATH=$PWD
## OPTIONS ##################################################### ## OPTIONS #####################################################
VERBOSE="true" VERBOSE="true"
INSTALL_PLUGINS="" INSTALL_PLUGINS=""
...@@ -103,9 +108,21 @@ while getopts "vap:d:w:hf:c:" opt; do ...@@ -103,9 +108,21 @@ while getopts "vap:d:w:hf:c:" opt; do
;; ;;
d) # deps path d) # deps path
DEPS_PATH=$OPTARG DEPS_PATH=$OPTARG
if cd $DEPS_PATH ; then
func_echo "Valid dependency path."
else
echo "Invalid dependency path."
exit 1
fi
;; ;;
w) # wolf path w) # wolf path
WOLF_PATH=$OPTARG WOLF_PATH=$OPTARG
if cd $WOLF_PATH ; then
func_echo "Valid wolf folder path."
else
echo "Invalid wolf folder path."
exit 1
fi
;; ;;
h ) h )
usage usage
...@@ -123,10 +140,6 @@ while getopts "vap:d:w:hf:c:" opt; do ...@@ -123,10 +140,6 @@ while getopts "vap:d:w:hf:c:" opt; do
esac esac
done done
# START #####################################################
CORES=$(nproc)
func_echo "The number of available cores on this machine is $CORES"
RUN_PATH=$PWD
# UBUNTU # UBUNTU
if [ "$UID" -eq 0 -o "$EUID" -eq 0 ]; then if [ "$UID" -eq 0 -o "$EUID" -eq 0 ]; then
...@@ -148,12 +161,16 @@ fi ...@@ -148,12 +161,16 @@ fi
# WOLF DEPENDENCIES ##################################################### # WOLF DEPENDENCIES #####################################################
cd $RUN_PATH
func_echo "You are in folder $PWD" func_echo "You are in folder $PWD"
if [ $DEPS_PATH == "undefined" ]; then if [ $DEPS_PATH == "undefined" ]; then
echo "Enter path for dependencies (either /global/path or relative/path):" echo "Enter path for dependencies (either /global/path or relative/path):"
read DEPS_PATH read DEPS_PATH
fi 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 DEPS_PATH=$PWD
func_echo "path dependencies: $DEPS_PATH" func_echo "path dependencies: $DEPS_PATH"
...@@ -227,7 +244,10 @@ if [ $WOLF_PATH == "undefined" ]; then ...@@ -227,7 +244,10 @@ if [ $WOLF_PATH == "undefined" ]; then
echo "Enter path for wolf folder (either /global/path or relative/path):" echo "Enter path for wolf folder (either /global/path or relative/path):"
read WOLF_PATH read WOLF_PATH
fi 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 mkdir wolf
cd wolf cd wolf
WOLF_PATH=$PWD WOLF_PATH=$PWD
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment