make_and_put_all.sh 3.0 KB

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