Update setup.sh

added ./setup.sh --auto-install 
(no interactive mode)
This commit is contained in:
masterzion 2021-08-23 23:16:26 +02:00 committed by GitHub
parent 9691563066
commit d7918ca8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ function check_installed_python() {
check_installed_pip check_installed_pip
return return
fi fi
done done
echo "No usable python found. Please make sure to have python3.7 or newer installed" echo "No usable python found. Please make sure to have python3.7 or newer installed"
exit 1 exit 1
@ -48,16 +48,27 @@ function updateenv() {
SYS_ARCH=$(uname -m) SYS_ARCH=$(uname -m)
echo "pip install in-progress. Please wait..." echo "pip install in-progress. Please wait..."
${PYTHON} -m pip install --upgrade pip ${PYTHON} -m pip install --upgrade pip
read -p "Do you want to install dependencies for dev [y/N]? " if [[ "$1" == "auto" ]]
then
REPLY="n"
else
read -p "Do you want to install dependencies for dev [y/N]? "
fi
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
REQUIREMENTS=requirements-dev.txt REQUIREMENTS=requirements-dev.txt
else else
REQUIREMENTS=requirements.txt REQUIREMENTS=requirements.txt
fi fi
REQUIREMENTS_HYPEROPT="" REQUIREMENTS_HYPEROPT=""
REQUIREMENTS_PLOT="" REQUIREMENTS_PLOT=""
read -p "Do you want to install plotting dependencies (plotly) [y/N]? " if [[ "$1" == "auto" ]]
then
REPLY="y"
else
read -p "Do you want to install plotting dependencies (plotly) [y/N]? "
fi
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
REQUIREMENTS_PLOT="-r requirements-plot.txt" REQUIREMENTS_PLOT="-r requirements-plot.txt"
@ -67,13 +78,19 @@ function updateenv() {
${PYTHON} -m pip install --upgrade cython ${PYTHON} -m pip install --upgrade cython
else else
# Is not Raspberry # Is not Raspberry
read -p "Do you want to install hyperopt dependencies [y/N]? " if [[ "$1" == "auto" ]]
then
REPLY="y"
else
read -p "Do you want to install hyperopt dependencies [y/N]? "
fi
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
REQUIREMENTS_HYPEROPT="-r requirements-hyperopt.txt" REQUIREMENTS_HYPEROPT="-r requirements-hyperopt.txt"
fi fi
fi fi
${PYTHON} -m pip install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT} ${PYTHON} -m pip install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed installing dependencies" echo "Failed installing dependencies"
@ -110,8 +127,8 @@ function install_talib() {
cd .. cd ..
} }
function install_mac_newer_python_dependencies() { function install_mac_newer_python_dependencies() {
if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ] if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ]
then then
echo "-------------------------" echo "-------------------------"
@ -126,7 +143,7 @@ function install_mac_newer_python_dependencies() {
echo "Installing c-blosc" echo "Installing c-blosc"
echo "-------------------------" echo "-------------------------"
brew install c-blosc brew install c-blosc
fi fi
} }
# Install bot MacOS # Install bot MacOS
@ -140,7 +157,7 @@ function install_macos() {
fi fi
#Gets number after decimal in python version #Gets number after decimal in python version
version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g') version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g')
if [[ $version -ge 9 ]]; then #Checks if python version >= 3.9 if [[ $version -ge 9 ]]; then #Checks if python version >= 3.9
install_mac_newer_python_dependencies install_mac_newer_python_dependencies
fi fi
@ -157,7 +174,7 @@ function install_debian() {
# Upgrade the bot # Upgrade the bot
function update() { function update() {
git pull git pull
updateenv updateenv $1
} }
# Reset Develop or Stable branch # Reset Develop or Stable branch
@ -169,7 +186,13 @@ function reset() {
if [ "1" == $(git branch -vv |grep -cE "\* develop|\* stable") ] if [ "1" == $(git branch -vv |grep -cE "\* develop|\* stable") ]
then then
read -p "Reset git branch? (This will remove all changes you made!) [y/N]? " if [[ "$1" == "auto" ]]
then
REPLY="n"
else
read -p "Reset git branch? (This will remove all changes you made!) [y/N]? "
fi
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
git fetch -a git fetch -a
@ -198,7 +221,7 @@ function reset() {
echo "Could not create virtual environment. Leaving now" echo "Could not create virtual environment. Leaving now"
exit 1 exit 1
fi fi
updateenv updateenv $1
} }
function config() { function config() {
@ -212,6 +235,7 @@ function install() {
echo "-------------------------" echo "-------------------------"
echo "Installing mandatory dependencies" echo "Installing mandatory dependencies"
echo "-------------------------" echo "-------------------------"
SET_DEFAULT=$1
if [ "$(uname -s)" == "Darwin" ] if [ "$(uname -s)" == "Darwin" ]
then then
@ -228,8 +252,8 @@ function install() {
sleep 10 sleep 10
fi fi
echo echo
reset reset $SET_DEFAULT
config config $SET_DEFAULT
echo "-------------------------" echo "-------------------------"
echo "Run the bot !" echo "Run the bot !"
echo "-------------------------" echo "-------------------------"
@ -249,11 +273,12 @@ function plot() {
function help() { function help() {
echo "usage:" echo "usage:"
echo " -i,--install Install freqtrade from scratch" echo " -a,--auto-install Install freqtrade from scratch"
echo " -u,--update Command git pull to update." echo " -i,--install Install freqtrade from scratch"
echo " -r,--reset Hard reset your develop/stable branch." echo " -u,--update Command git pull to update."
echo " -c,--config Easy config generator (Will override your existing file)." echo " -r,--reset Hard reset your develop/stable branch."
echo " -p,--plot Install dependencies for Plotting scripts." echo " -c,--config Easy config generator (Will override your existing file)."
echo " -p,--plot Install dependencies for Plotting scripts."
} }
# Verify if 3.7 or 3.8 is installed # Verify if 3.7 or 3.8 is installed
@ -263,6 +288,9 @@ case $* in
--install|-i) --install|-i)
install install
;; ;;
--auto-install|-a)
install "auto"
;;
--config|-c) --config|-c)
config config
;; ;;