Improve preflight check + check total ram

This commit is contained in:
the-sane 2021-01-24 15:37:06 -05:00 committed by GitHub
parent 4a4d8a0f2a
commit b7a36a872b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -639,6 +639,16 @@ filelimit_check() {
#------------------------- end filelimit functions ---------------------------# #------------------------- end filelimit functions ---------------------------#
# Check total system memory
memory_check() {
memtotal="$(awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
if awk 'BEGIN {exit !("$memtotal" < 15)}'; then
preflight_pass+=("Your system has $memtotal GB of memory.")
else
preflight_fail+=("Your system has $memtotal GB of memory.\nWe recommend at least 16 GB to avoid crashes.")
fi
}
# Delete the shaders directory # Delete the shaders directory
rm_shaders() { rm_shaders() {
# Get/Set directory paths # Get/Set directory paths
@ -1028,6 +1038,7 @@ preflight_check() {
unset preflight_followup unset preflight_followup
# Call the optimization functions to perform the checks # Call the optimization functions to perform the checks
memory_check
mapcount_check mapcount_check
filelimit_check filelimit_check
@ -1064,7 +1075,9 @@ preflight_check() {
if [ -z "$preflight_fail_string" ]; then if [ -z "$preflight_fail_string" ]; then
message info "Preflight Check Complete\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string" message info "Preflight Check Complete\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
else else
if message question "$preflight_pass_string$preflight_fail_string\n\nWould you like configuration issues to be fixed for you?"; then if [ -z "$preflight_action_funcs" ]; then
message warning "$preflight_pass_string$preflight_fail_string"
elif message question "$preflight_pass_string$preflight_fail_string\n\nWould you like configuration issues to be fixed for you?"; then
# Call functions to build fixes for any issues found # Call functions to build fixes for any issues found
for (( i=0; i<"${#preflight_action_funcs[@]}"; i++ )); do for (( i=0; i<"${#preflight_action_funcs[@]}"; i++ )); do
${preflight_action_funcs[i]} ${preflight_action_funcs[i]}
@ -1105,8 +1118,11 @@ preflight_check() {
# Display the results # Display the results
message info "$preflight_results_string" message info "$preflight_results_string"
else else
# Show the user the manual configuration options # User declined to automatically fix configuration issues
message info "$preflight_manual_string" # Show manual configuration options
if [ ! -z "$preflight_manual_string" ]; then
message info "$preflight_manual_string"
fi
fi fi
fi fi
} }