make_and_put_all.sh 2.9 KB

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