check.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. check_tmuxception.sh
  14. if [ "$(whoami)" != "root" ]; then
  15. if [ "${commandname}" != "MONITOR" ]; then
  16. check_permissions.sh
  17. fi
  18. fi
  19. if [ "${commandname}" != "INSTALL" ]&&[ "${commandname}" != "UPDATE-LGSM" ]&&[ "${commandname}" != "DETAILS" ]&&[ "${commandname}" != "POST-DETAILS" ]; then
  20. check_system_dir.sh
  21. fi
  22. allowed_commands_array=( START DEBUG )
  23. for allowed_command in "${allowed_commands_array[@]}"
  24. do
  25. if [ "${allowed_command}" == "${commandname}" ]; then
  26. check_executable.sh
  27. fi
  28. done
  29. if [ "$(whoami)" != "root" ]; then
  30. allowed_commands_array=( DEBUG START INSTALL )
  31. for allowed_command in "${allowed_commands_array[@]}"
  32. do
  33. if [ "${allowed_command}" == "${commandname}" ]; then
  34. check_glibc.sh
  35. fi
  36. done
  37. fi
  38. 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 )
  39. for allowed_command in "${allowed_commands_array[@]}"
  40. do
  41. if [ "${allowed_command}" == "${commandname}" ]; then
  42. check_logs.sh
  43. fi
  44. done
  45. allowed_commands_array=( DEBUG START STOP )
  46. for allowed_command in "${allowed_commands_array[@]}"
  47. 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[@]}"
  54. do
  55. if [ "${allowed_command}" == "${commandname}" ]; then
  56. check_config.sh
  57. fi
  58. done
  59. allowed_commands_array=( DEBUG DETAILS POST_DETAILS MONITOR START STOP DEV-QUERY-RAW )
  60. for allowed_command in "${allowed_commands_array[@]}"
  61. do
  62. if [ "${allowed_command}" == "${commandname}" ]; then
  63. if [ -z "${installflag}" ]; then
  64. check_ip.sh
  65. fi
  66. fi
  67. done
  68. allowed_commands_array=( DEBUG START VALIDATE )
  69. for allowed_command in "${allowed_commands_array[@]}"
  70. do
  71. if [ "${allowed_command}" == "${commandname}" ]; then
  72. if [ "${appid}" ]; then
  73. check_steamcmd.sh
  74. fi
  75. fi
  76. done
  77. allowed_commands_array=( DETAILS MONITOR START STOP CHANGE-PASSWORD UPDATE VALIDATE )
  78. for allowed_command in "${allowed_commands_array[@]}"
  79. do
  80. if [ "${allowed_command}" == "${commandname}" ]; then
  81. check_status.sh
  82. fi
  83. done
  84. allowed_commands_array=( DEBUG START INSTALL )
  85. for allowed_command in "${allowed_commands_array[@]}"
  86. do
  87. if [ "${allowed_command}" == "${commandname}" ]; then
  88. check_system_requirements.sh
  89. fi
  90. done