server.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. if [ -x "/sbin/ldconfig" ]; then
  46. if [ -z "$(/sbin/ldconfig -p | grep "libSDL-1.2")" ]; then
  47. echo "To run AssaultCube, please ensure SDL v1.2 libraries are installed."
  48. exit 1
  49. fi
  50. if [ -z "$(/sbin/ldconfig -p | grep "libz")" ]; then
  51. echo "To run AssaultCube, please ensure z libraries are installed."
  52. exit 1
  53. fi
  54. if [ -z "$(/sbin/ldconfig -p | grep "libcurl")" ]; then
  55. echo "To run AssaultCube, please ensure Curl libraries are installed."
  56. exit 1
  57. fi
  58. fi
  59. if [ -x "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ]; then
  60. cd "${CUBE_DIR}"
  61. exec "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ${CUBE_OPTIONS} ${CUBE_OPTIONFILE} "$@"
  62. elif [ -e "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ]; then
  63. echo "Insufficient permissons to run AssaultCube."
  64. echo "Please change (chmod) the AssaultCube server in the bin_unix folder to be readable/executable."
  65. else
  66. echo "Your platform does not have a pre-compiled AssaultCube server."
  67. echo "Please follow the following steps to build a native client:"
  68. echo "1) Ensure you have the following DEVELOPMENT libraries installed:"
  69. echo " SDL, zlib, libcurl"
  70. echo "2) Ensure clang++ and any other required build tools are installed."
  71. echo "3) Change directory to ./source/src/ and type \"make server_install\"."
  72. echo "4) If the compile succeeds, return to this directory and re-run this script."
  73. exit 1
  74. fi