You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
1.5KB

  1. #!/bin/bash
  2. set -eu
  3. if [ ! -d "mosfet" ]
  4. then
  5. echo "You must run this from the mosfet-minecraft-bot directory."
  6. exit
  7. fi
  8. if ! command -v virtualenv &> /dev/null
  9. then
  10. echo "virtualenv could not be found, please install with:"
  11. echo "sudo apt install virtualenv"
  12. exit
  13. fi
  14. if ! command -v wget &> /dev/null
  15. then
  16. echo "wget could not be found, please install with:"
  17. echo "sudo apt install wget"
  18. exit
  19. fi
  20. if ! command -v unzip &> /dev/null
  21. then
  22. echo "unzip could not be found, please install with:"
  23. echo "sudo apt install unzip"
  24. exit
  25. fi
  26. if ! command -v python3 &> /dev/null
  27. then
  28. echo "python3 could not be found, please install with:"
  29. echo "sudo apt install python3"
  30. exit
  31. fi
  32. if ! command -v pip3 &> /dev/null
  33. then
  34. echo "pip3 could not be found, please install with:"
  35. echo "sudo apt install pip3"
  36. exit
  37. fi
  38. if ! command -v git &> /dev/null
  39. then
  40. echo "git could not be found, please install with:"
  41. echo "sudo apt install pip3"
  42. exit
  43. fi
  44. # download minecraft data
  45. echo "Grabbing minecraft data..."
  46. VERSION="1.16.4"
  47. wget -Omcdata.zip "https://apimon.de/mcdata/$VERSION/$VERSION.zip"
  48. rm -r minecraft_data || true
  49. mkdir minecraft_data
  50. unzip mcdata.zip -d minecraft_data
  51. rm mcdata.zip
  52. # update code
  53. git stash
  54. git pull --rebase
  55. git stash pop || true
  56. # https://github.com/pypa/virtualenv/issues/1029
  57. PS1=${PS1:-}
  58. # create virtual environment
  59. echo "Installing Python requirements..."
  60. rm -r env || true
  61. rm -r __pycache__ || true
  62. virtualenv -p python3 env
  63. source env/bin/activate
  64. pip install -r requirements.txt
  65. echo "Done."