install_opentyrian2000.sh 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. doas pkg_add sdl2 sdl2-net gmake unzip curl
  3. application=opentyrian2000
  4. repository="https://github.com/KScl/opentyrian2000.git"
  5. export compile=
  6. mkdir -p ~/src
  7. cd ~/src || return
  8. if [ ! -d $application ]; then
  9. git clone $repository
  10. cd $application || return
  11. export compile=true
  12. else
  13. cd $application || return
  14. #git pull
  15. pwd
  16. git fetch
  17. LOCAL=$(git rev-parse HEAD)
  18. REMOTE=$(git rev-parse @{u})
  19. if [ ! $LOCAL = $REMOTE ]; then
  20. pwd
  21. echo "Need to pull"
  22. git pull
  23. export compile=true
  24. fi
  25. fi
  26. if [ "$compile" = "true" ]; then
  27. cd ~/src/$application || return
  28. gmake
  29. # download game data
  30. if [ ! -d ~/games/opentyrian/data/tyrian2000 ]; then
  31. mkdir -p ~/games/opentyrian/data
  32. cd ~/games/opentyrian/data
  33. curl -OL "https://www.camanis.net/tyrian/tyrian2000.zip"
  34. unzip tyrian2000.zip
  35. rm *.zip
  36. fi
  37. echo "NOTE: To play run: $ ~/src/opentyrian2000/opentyrian2000 --data=~/games/opentyrian/data/tyrian2000/"
  38. fi