diff --git a/launch.sh b/launch.sh index f8e3a32..610eab8 100755 --- a/launch.sh +++ b/launch.sh @@ -28,6 +28,8 @@ elif [ "$1" == "html5" ]; then python3 etc/report_generator5.py elif [[ "$1" == add* ]]; then python3 script/addFav.py +elif [ "$1" == "update" ]; then + ./update.sh else echo "Please provide a bot to launch (pong/mesh) or a report to generate (html/html5) or addFav" exit 1 diff --git a/update.sh b/update.sh index 471752b..f464758 100644 --- a/update.sh +++ b/update.sh @@ -43,16 +43,20 @@ echo "Local repository updated." # Install or update dependencies echo "Installing or updating dependencies..." -# check for error: externally-managed-environment and ask if user wants to continue with --break-system-packages -if ! pip install -r requirements.txt --upgrade 2>&1 | grep -q "externally-managed-environment"; then - pip install -r requirements.txt --upgrade -else - read -p "Warning: You are in an externally managed environment. Do you want to continue with --break-system-packages? (y/n): " choice - if [[ "$choice" == "y" || "$choice" == "Y" ]]; then - pip install --break-system-packages -r requirements.txt --upgrade +if pip install -r requirements.txt --upgrade 2>&1 | grep -q "externally-managed-environment"; then + # if venv is found ask to run with launch.sh + if [ -d "venv" ]; then + echo "A virtual environment (venv) was found. Use launch.sh to update dependencies in the venv." else - echo "Update aborted due to dependency installation issue." + read -p "Warning: You are in an externally managed environment. Do you want to continue with --break-system-packages? (y/n): " choice + if [[ "$choice" == "y" || "$choice" == "Y" ]]; then + pip install --break-system-packages -r requirements.txt --upgrade + else + echo "Update aborted due to dependency installation issue." + fi fi +else + echo "Dependencies installed or updated." fi echo "Dependencies installed or updated."