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

@ -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
if [[ "$1" == "auto" ]]
then
REPLY="n"
else
read -p "Do you want to install dependencies for dev [y/N]? " 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=""
if [[ "$1" == "auto" ]]
then
REPLY="y"
else
read -p "Do you want to install plotting dependencies (plotly) [y/N]? " 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
if [[ "$1" == "auto" ]]
then
REPLY="y"
else
read -p "Do you want to install hyperopt dependencies [y/N]? " 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"
@ -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
if [[ "$1" == "auto" ]]
then
REPLY="n"
else
read -p "Reset git branch? (This will remove all changes you made!) [y/N]? " 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,6 +273,7 @@ function plot() {
function help() { function help() {
echo "usage:" echo "usage:"
echo " -a,--auto-install Install freqtrade from scratch"
echo " -i,--install Install freqtrade from scratch" echo " -i,--install Install freqtrade from scratch"
echo " -u,--update Command git pull to update." echo " -u,--update Command git pull to update."
echo " -r,--reset Hard reset your develop/stable branch." echo " -r,--reset Hard reset your develop/stable branch."
@ -263,6 +288,9 @@ case $* in
--install|-i) --install|-i)
install install
;; ;;
--auto-install|-a)
install "auto"
;;
--config|-c) --config|-c)
config config
;; ;;