check_system_requirements.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # LinuxGSM check_system_requirements.sh
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Checks RAM requirements.
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. info_distro.sh
  9. if [[ "${arch}" != "x86_64" && "${arch}" != "i386" && "${arch}" != "i686" ]]; then
  10. echo -e "${red}Error: Only x86 type architectures are supported. Detected architecture: ${arch}${default}"
  11. fn_script_log_error "Only x86 type architectures are supported. Detected architecture: ${arch}"
  12. core_exit.sh
  13. fi
  14. if [ "${shortname}" == "ark" ]; then
  15. ramrequirementgb="7"
  16. elif [ "${shortname}" == "arma3" ]; then
  17. ramrequirementgb="2"
  18. elif [ "${shortname}" == "armar" ]; then
  19. ramrequirementgb="3"
  20. elif [ "${shortname}" == "bt" ]; then
  21. ramrequirementgb="1"
  22. elif [ "${shortname}" == "cc" ]; then
  23. ramrequirementgb="1"
  24. elif [ "${shortname}" == "dayz" ]; then
  25. ramrequirementgb="5"
  26. elif [ "${shortname}" == "dodr" ]; then
  27. ramrequirementgb="2"
  28. elif [ "${shortname}" == "hw" ]; then
  29. ramrequirementgb="3"
  30. elif [ "${shortname}" == "mc" ]; then
  31. ramrequirementgb="1"
  32. elif [ "${shortname}" == "pmc" ]; then
  33. ramrequirementgb="2"
  34. elif [ "${shortname}" == "mh" ]; then
  35. ramrequirementgb="4"
  36. elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then
  37. ramrequirementgb="1"
  38. elif [ "${shortname}" == "squad44" ]; then
  39. ramrequirementgb="2"
  40. elif [ "${shortname}" == "pvr" ]; then
  41. ramrequirementgb="1"
  42. elif [ "${shortname}" == "pz" ]; then
  43. ramrequirementgb="3"
  44. elif [ "${shortname}" == "rust" ]; then
  45. ramrequirementgb="9"
  46. elif [ "${shortname}" == "sdtd" ]; then
  47. ramrequirementgb="4"
  48. elif [ "${shortname}" == "sf" ]; then
  49. ramrequirementgb="12"
  50. elif [ "${shortname}" == "squad" ]; then
  51. ramrequirementgb="2"
  52. elif [ "${shortname}" == "sm" ]; then
  53. ramrequirementgb="10"
  54. elif [ "${shortname}" == "st" ]; then
  55. ramrequirementgb="1"
  56. elif [ "${shortname}" == "stn" ]; then
  57. ramrequirementgb="3"
  58. elif [ "${shortname}" == "tu" ]; then
  59. ramrequirementgb="2"
  60. elif [ "${shortname}" == "vh" ]; then
  61. ramrequirementgb="2"
  62. else
  63. ramrequirementgb="0.5"
  64. fi
  65. # If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
  66. if [ "${ramrequirementgb}" ]; then
  67. if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then
  68. fn_print_dots "Checking RAM"
  69. fn_print_warn_nl "Checking RAM: Minumum RAM requirements not met"
  70. fn_print_nl "* ${ramrequirementgb}G is required, but only ${physmemtotal} is available."
  71. fn_print_nl "* ${gamename} server may fail to run or experience poor performance."
  72. fn_sleep_time_5
  73. fi
  74. fi