check.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. # LinuxGSM check.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Overall function for managing checks.
  6. # Runs checks that will either halt on or fix an issue.
  7. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. # Every command that requires checks just references check.sh.
  9. # check.sh selects which checks to run by using arrays.
  10. if [ "${commandname}" != "INSTALL" ]; then
  11. check_root.sh
  12. fi
  13. if [ "${commandname}" != "UPDATE-LGSM" ]; then
  14. check_version.sh
  15. fi
  16. check_tmuxception.sh
  17. if [ "$(whoami)" != "root" ]; then
  18. if [ "${commandname}" != "MONITOR" ]; then
  19. check_permissions.sh
  20. fi
  21. fi
  22. if [ "${commandname}" != "INSTALL" ]&&[ "${commandname}" != "UPDATE-LGSM" ]&&[ "${commandname}" != "DETAILS" ]&&[ "${commandname}" != "POST-DETAILS" ]; then
  23. check_system_dir.sh
  24. fi
  25. allowed_commands_array=( START DEBUG )
  26. for allowed_command in "${allowed_commands_array[@]}"
  27. do
  28. if [ "${allowed_command}" == "${commandname}" ]; then
  29. check_executable.sh
  30. fi
  31. done
  32. if [ "$(whoami)" != "root" ]; then
  33. allowed_commands_array=( DEBUG START INSTALL )
  34. for allowed_command in "${allowed_commands_array[@]}"
  35. do
  36. if [ "${allowed_command}" == "${commandname}" ]; then
  37. check_glibc.sh
  38. fi
  39. done
  40. fi
  41. allowed_commands_array=( BACKUP CONSOLE DEBUG DETAILS MAP-COMPRESSOR FASTDL MODS-INSTALL MODS-REMOVE MODS-UPDATE MONITOR POST-DETAILS RESTART START STOP TEST-ALERT CHANGE-PASSWORD UPDATE UPDATE-LGSM VALIDATE WIPW )
  42. for allowed_command in "${allowed_commands_array[@]}"
  43. do
  44. if [ "${allowed_command}" == "${commandname}" ]; then
  45. check_logs.sh
  46. fi
  47. done
  48. allowed_commands_array=( DEBUG START STOP )
  49. for allowed_command in "${allowed_commands_array[@]}"
  50. do
  51. if [ "${allowed_command}" == "${commandname}" ]; then
  52. check_deps.sh
  53. fi
  54. done
  55. allowed_commands_array=( CONSOLE DEBUG MONITOR START STOP )
  56. for allowed_command in "${allowed_commands_array[@]}"
  57. do
  58. if [ "${allowed_command}" == "${commandname}" ]; then
  59. check_config.sh
  60. fi
  61. done
  62. allowed_commands_array=( DEBUG DETAILS POST_DETAILS MONITOR START STOP DEV-QUERY-RAW )
  63. for allowed_command in "${allowed_commands_array[@]}"
  64. do
  65. if [ "${allowed_command}" == "${commandname}" ]; then
  66. if [ -z "${installflag}" ]; then
  67. check_ip.sh
  68. fi
  69. fi
  70. done
  71. allowed_commands_array=( DEBUG START VALIDATE )
  72. for allowed_command in "${allowed_commands_array[@]}"
  73. do
  74. if [ "${allowed_command}" == "${commandname}" ]; then
  75. if [ "${appid}" ]; then
  76. check_steamcmd.sh
  77. fi
  78. fi
  79. done
  80. allowed_commands_array=( DETAILS MONITOR START STOP CHANGE-PASSWORD UPDATE VALIDATE )
  81. for allowed_command in "${allowed_commands_array[@]}"
  82. do
  83. if [ "${allowed_command}" == "${commandname}" ]; then
  84. check_status.sh
  85. fi
  86. done
  87. allowed_commands_array=( DEBUG START INSTALL )
  88. for allowed_command in "${allowed_commands_array[@]}"
  89. do
  90. if [ "${allowed_command}" == "${commandname}" ]; then
  91. check_system_requirements.sh
  92. fi
  93. done