server.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # CUBE_DIR should refer to the directory in which AssaultCube is placed.
  3. #CUBE_DIR=~/assaultcube
  4. #CUBE_DIR=/usr/local/assaultcube
  5. CUBE_DIR=.
  6. # CUBE_OPTIONS starts AssaultCube with any command line options you choose.
  7. CUBE_OPTIONS=""
  8. # Comment this out, to disable reading command line options from config/servercmdline.txt
  9. # If enabled, any options under CUBE_OPTIONS are superseded by options in servercmdline.txt
  10. CUBE_OPTIONFILE=-Cconfig/servercmdline.txt
  11. # SYSTEM_NAME should be set to the name of your operating system.
  12. #SYSTEM_NAME=Linux
  13. SYSTEM_NAME=`uname -s`
  14. # MACHINE_NAME should be set to the architecture of your processor.
  15. #MACHINE_NAME=i686
  16. MACHINE_NAME=`uname -m`
  17. case ${SYSTEM_NAME} in
  18. Linux)
  19. SYSTEM_NAME=linux_
  20. ;;
  21. *)
  22. SYSTEM_NAME=unknown_
  23. ;;
  24. esac
  25. case ${MACHINE_NAME} in
  26. i486|i586|i686)
  27. MACHINE_NAME=
  28. ;;
  29. x86_64)
  30. MACHINE_NAME=64_
  31. ;;
  32. *)
  33. if [ ${SYSTEM_NAME} != native_ ]
  34. then
  35. SYSTEM_NAME=native_
  36. fi
  37. MACHINE_NAME=
  38. ;;
  39. esac
  40. if [ -x "${CUBE_DIR}/bin_unix/native_server" ]
  41. then
  42. SYSTEM_NAME=native_
  43. MACHINE_NAME=
  44. fi
  45. BINARYPATH="${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server"
  46. if [ "$1" = "--outputbinarypath" ]; then
  47. echo "${BINARYPATH}"
  48. exit 0
  49. elif [ -x "${BINARYPATH}" ]; then
  50. cd "${CUBE_DIR}"
  51. exec "${BINARYPATH}" ${CUBE_OPTIONS} ${CUBE_OPTIONFILE} "$@"
  52. else
  53. echo "Your platform does not have a pre-compiled AssaultCube server."
  54. echo "Please follow the following steps to build a native client:"
  55. echo "1) Ensure you have the following DEVELOPMENT libraries installed:"
  56. echo " zlib"
  57. echo "2) Ensure clang++ and any other required build tools are installed."
  58. echo "3) Change directory to ./source/src/ and type \"make server_install\"."
  59. echo "4) If the compile succeeds, return to this directory and re-run this script."
  60. exit 1
  61. fi