make_and_put_all.sh 3.2 KB

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