check.sh 3.1 KB

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