install_obsidian.sh 900 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. $su apt-get install -y build-essential make cmake binutils
  11. $su apt-get install -y libxft-dev libfontconfig1-dev
  12. $su apt-get install -y flex
  13. application=Obsidian
  14. repository=https://github.com/obsidian-level-maker/Obsidian.git
  15. export compile=
  16. mkdir -p ~/src
  17. cd ~/src || return
  18. if [ ! -d $application ]; then
  19. git clone $repository
  20. cd $application || return
  21. export compile=true
  22. else
  23. cd $application || return
  24. #git pull
  25. pwd
  26. git fetch
  27. LOCAL=$(git rev-parse HEAD)
  28. REMOTE=$(git rev-parse @{u})
  29. if [ ! $LOCAL = $REMOTE ]; then
  30. pwd
  31. echo "Need to pull"
  32. git pull
  33. export compile=true
  34. fi
  35. fi
  36. if [ "$compile" = "true" ]; then
  37. cd ~/src/$application || return
  38. cmake --preset dist
  39. cmake --build --preset dist
  40. fi