make_and_put_all.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/usr/bin/env bash
  2. #Paul Klumpp 2012-11-19
  3. cwd=$(pwd)
  4. q2srv=$cwd/../q2srv/
  5. cd $cwd
  6. function checkinstalled {
  7. if [ "$1" != "" ]; then
  8. I=$(which "$1")
  9. if [ -f "$I" ]; then
  10. echo 1
  11. else
  12. echo 0
  13. fi
  14. fi
  15. }
  16. software="git make cc realpath lua screen"
  17. for s in $software; do
  18. if [ ! $(checkinstalled "$s") ]; then
  19. echo "'$s' not found on your system. Please have a system administrator install it!"
  20. return 0
  21. fi
  22. done
  23. echo "Before continuing, make sure you have the following installed:"
  24. echo "* Lua 5.1, only 5.1!, dev headers"
  25. echo "* libz, also known as zlib"
  26. echo
  27. echo " PRESS ENTER"
  28. echo
  29. read
  30. repo[1]="q2admin"
  31. url[1]="https://github.com/hifi/q2admin.git"
  32. makeit[1]="make clean && make"
  33. repo[2]="aq2-tng"
  34. url[2]="https://github.com/hifi/aq2-tng.git"
  35. makeit[2]="cd source && pwd && make clean && make"
  36. repo[3]="q2a_mvd"
  37. url[3]="git://b4r.org/q2a_mvd"
  38. makeit[3]=""
  39. repo[4]="gs_starter"
  40. url[4]="git://b4r.org/gs_starter"
  41. makeit[4]=""
  42. repo[5]="q2pro"
  43. url[5]="http://git.skuller.net/q2pro"
  44. makeit[5]="cp ../q2proconfig ./.config && make clean && INCLUDES='-DUSE_PACKETDUP=1' make q2proded"
  45. ARCH=$(uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
  46. for idx in ${!repo[*]}; do
  47. echo
  48. # get it
  49. echo "$idx: ${repo[$idx]} from ${url[$idx]}"
  50. if [ ! -d "${repo[$idx]}" ]; then
  51. git clone ${url[$idx]}
  52. else
  53. echo "Dir exists, we begin making"
  54. cd $cwd/${repo[$idx]}
  55. git pull
  56. cd ..
  57. fi
  58. # make it
  59. cd $cwd/${repo[$idx]}
  60. eval ${makeit[$idx]}
  61. # install it
  62. case "${repo[$idx]}" in
  63. aq2-tng)
  64. cp -v game$ARCH.so $q2srv/action/game$ARCH.real.so
  65. cd ..
  66. cd action
  67. cp -v prules.ini $q2srv/action/
  68. cp -vr doc/ $q2srv/action/
  69. cp -vr models/ $q2srv/action/
  70. cp -vr pics/ $q2srv/action/
  71. cp -vr players/ $q2srv/action/
  72. cp -vr sound/ $q2srv/action/
  73. cp -vr tng/ $q2srv/action/
  74. ;;
  75. q2admin)
  76. if [ -f "game$ARCH.so" ]; then
  77. cp -v game$ARCH.so $q2srv/action/game$ARCH.so
  78. cp -vr plugins/ $q2srv/
  79. else
  80. echo "W0000000t .. q2admin did not compile. Something was wrong."
  81. echo "It is most possible because Lua5.1 is missing."
  82. echo
  83. echo "If you are on Debian or Ubuntu, please try to install the following"
  84. echo "package server wide: liblua5.1-0-dev"
  85. echo
  86. echo "To do that, try: 'sudo apt-get install liblua5.1-0-dev'"
  87. echo
  88. echo "Then start this script again."
  89. echo
  90. return 0
  91. fi
  92. ;;
  93. q2a_mvd)
  94. cp mvd.lua $q2srv/plugins/
  95. ;;
  96. gs_starter)
  97. cp -v gs_starter.sh $q2srv/
  98. if [ ! -f "$q2srv/gs_starter.cfg" ]; then
  99. cp -v gs_starter.cfg $q2srv
  100. fi
  101. ;;
  102. q2pro)
  103. cp -v q2proded $q2srv/
  104. ;;
  105. esac
  106. cd $cwd
  107. echo
  108. done