1
0

upgrade.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. set -e # Exit immediately if any command exits with a non-zero status
  3. activate_venv() {
  4. source env/bin/activate || { echo "Failed to activate virtual environment"; exit 1; }
  5. }
  6. update_modules() {
  7. pip install --upgrade pip || { echo "Failed to upgrade pip"; exit 1; } # Upgrade pip
  8. pip install -e . || { echo "Failed to install/upgrade module"; exit 1; } # Install/upgrade modules
  9. }
  10. update_config() {
  11. local bak_file="instance/config.py.bak"
  12. read -p "Enter the external URL your OwnchatBot uses, with \"https://\": " OCB_URL
  13. if [[ -n "$OCB_URL" ]]; then # Check if OCB_URL is not empty
  14. echo "" >> instance/config.py # Append an empty line so it formats correctly
  15. echo "OCB_URL = '$OCB_URL'" >> instance/config.py # Append the new line
  16. echo "Set OCB_URL successfully."
  17. cp instance/config.py "$bak_file"
  18. rm "$bak_file" # Remove the .bak file if the update was successful
  19. else
  20. echo "Failed to set OCB_URL. Please provide a valid URL."
  21. exit 1 # Exit the script with a non-zero status
  22. fi
  23. }
  24. # activate_venv
  25. # update_modules
  26. update_config
  27. # deactivate
  28. echo -e "Your OwnchatBot configuration has been upgraded. Happy streaming!"