Compare commits

..

5 Commits

Author SHA1 Message Date
the-sane
0de4032a41 Bump version 2023-01-17 17:02:55 -05:00
the-sane
1acd82b411 Update winetricks preflight check for lutris builtin 2023-01-17 17:00:23 -05:00
the-sane
dc48c7acac Fix whitespace 2023-01-17 16:44:53 -05:00
the-sane
d5c3cd66a0 Reorder preflight check, put failures first 2023-01-17 16:41:02 -05:00
the-sane
7d005f2070 Add lutris version check to preflight check 2023-01-17 16:28:07 -05:00

View File

@ -107,6 +107,9 @@ menu_option_height="26"
# winetricks minimum version
winetricks_required="20220411"
# lutris minimum version
lutris_required="0.5.10.1"
######## Game Directories ##################################################
# The game's base directory name
@ -190,7 +193,7 @@ lug_wiki="https://github.com/starcitizen-lug/information-howtos/wiki"
# Github repo and script version info
repo="starcitizen-lug/lug-helper"
releases_url="https://github.com/$repo/releases"
current_version="v2.1"
current_version="v2.2"
############################################################################
############################################################################
@ -775,24 +778,76 @@ filelimit_check() {
# Check if WINE is installed
wine_check() {
if [ -x "$(command -v wine)" ]; then
preflight_pass+=("Wine is installed on your system.")
preflight_pass+=("Wine is installed on your system.")
else
preflight_fail+=("Wine does not appear to be installed.\nAt a minimum, wine dependencies must be installed.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
fi
}
# Detect if lutris is installed
lutris_detect() {
lutris_installed="false"
lutris_native="false"
lutris_flatpak="false"
# Detect native lutris
if [ -x "$(command -v lutris)" ]; then
lutris_installed="true"
lutris_native="true"
fi
# Detect flatpak lutris
if [ -x "$(command -v flatpak)" ] && flatpak list --app | grep -q Lutris; then
lutris_installed="true"
lutris_flatpak="true"
fi
}
# Check the installed lutris version
lutris_check() {
lutris_detect
if [ "$lutris_installed" = "true" ]; then
# Check the native lutris version number
if [ "$lutris_native" = "true" ]; then
lutris_current="$(lutris -v)"
if [ "$lutris_required" != "$lutris_current" ] &&
[ "$lutris_current" = "$(printf "$lutris_current\n$lutris_required" | sort -V | head -n1)" ]; then
preflight_fail+=("Lutris is out of date.\nVersion $lutris_required or newer is required.")
else
preflight_pass+=("Lutris is installed and up to date.")
fi
fi
# Check the flatpak lutris version number
if [ "$lutris_flatpak" = "true" ]; then
lutris_current="$(flatpak run net.lutris.Lutris -v)"
if [ "$lutris_required" != "$lutris_current" ] &&
[ "$lutris_current" = "$(printf "$lutris_current\n$lutris_required" | sort -V | head -n1)" ]; then
preflight_fail+=("Flatpak Lutris is out of date.\nVersion $lutris_required or newer is required.")
else
preflight_pass+=("Flatpak Lutris is installed and up to date.")
fi
fi
else
preflight_fail+=("Lutris does not appear to be installed.\nFor manual installations, this may be ignored.")
fi
}
# Check the installed winetricks version
winetricks_check() {
if [ -x "$(command -v winetricks)" ]; then
winetricks_current="$(winetricks --version | awk '{print $1}')"
if [ "$winetricks_required" != "$winetricks_current" ] &&
[ "$winetricks_current" = "$(printf "$winetricks_current\n$winetricks_required" | sort -V | head -n1)" ]; then
preflight_fail+=("Winetricks is out of date.\nVersion $winetricks_required or newer is required.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
preflight_fail+=("Winetricks is out of date.\nVersion $winetricks_required or newer is required.\nIf installing the game through Lutris, this can be ignored.\nCheck that Use System Winetricks is disabled in Lutris Runner Options.")
else
preflight_pass+=("Winetricks is installed and up to date.")
preflight_pass+=("Winetricks is installed and up to date.")
fi
else
preflight_fail+=("Winetricks does not appear to be installed.\nVersion $winetricks_required or newer is required.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
preflight_fail+=("Winetricks does not appear to be installed.\nVersion $winetricks_required or newer is required.\nIf installing the game through Lutris, this can be ignored.\nCheck that Use System Winetricks is disabled in Lutris Runner Options.")
fi
}
@ -800,7 +855,7 @@ winetricks_check() {
memory_check() {
memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
if [ ${memtotal%.*} -ge "15" ]; then
preflight_pass+=("Your system has $memtotal GB of memory.")
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
@ -809,7 +864,7 @@ memory_check() {
# Check CPU for the required AVX extension
avx_check() {
if grep -q "avx" /proc/cpuinfo; then
preflight_pass+=("Your CPU supports the necessary AVX instruction set.")
preflight_pass+=("Your CPU supports the necessary AVX instruction set.")
else
preflight_fail+=("Your CPU does not appear to support AVX instructions.\nThis requirement was added to Star Citizen in version 3.11")
fi
@ -818,7 +873,7 @@ avx_check() {
# Check if swap is set up
swap_check() {
if cat /proc/swaps | grep -vq "Filename"; then
preflight_pass+=("You have swap space configured.")
preflight_pass+=("You have swap space configured.")
else
preflight_fail+=("You don't appear to have swap space configured.\nWe recommend configuring an 8-16 GB swap file.")
fi
@ -836,6 +891,7 @@ preflight_check() {
unset preflight_followup
# Call the optimization functions to perform the checks
lutris_check
wine_check
winetricks_check
memory_check
@ -845,17 +901,8 @@ preflight_check() {
filelimit_check
# Populate info strings with the results and add formatting
if [ "${#preflight_pass[@]}" -gt 0 ]; then
preflight_pass_string="Passed Checks:"
for (( i=0; i<"${#preflight_pass[@]}"; i++ )); do
preflight_pass_string="$preflight_pass_string\n- ${preflight_pass[i]//\\n/\\n }"
done
# Add extra newlines if there are also failures to report
if [ "${#preflight_fail[@]}" -gt 0 ]; then
preflight_pass_string="$preflight_pass_string\n\n"
fi
fi
if [ "${#preflight_fail[@]}" -gt 0 ]; then
# Failed checks
preflight_fail_string="Failed Checks:"
for (( i=0; i<"${#preflight_fail[@]}"; i++ )); do
if [ "$i" -eq 0 ]; then
@ -864,8 +911,20 @@ preflight_check() {
preflight_fail_string="$preflight_fail_string\n\n- ${preflight_fail[i]//\\n/\\n }"
fi
done
# Add extra newlines if there are also passes to report
if [ "${#preflight_pass[@]}" -gt 0 ]; then
preflight_fail_string="$preflight_fail_string\n\n"
fi
fi
if [ "${#preflight_pass[@]}" -gt 0 ]; then
# Passed checks
preflight_pass_string="Passed Checks:"
for (( i=0; i<"${#preflight_pass[@]}"; i++ )); do
preflight_pass_string="$preflight_pass_string\n- ${preflight_pass[i]//\\n/\\n }"
done
fi
for (( i=0; i<"${#preflight_manual[@]}"; i++ )); do
# Instructions for manually fixing problems
if [ "$i" -eq 0 ]; then
preflight_manual_string="${preflight_manual[i]}"
else
@ -884,8 +943,8 @@ preflight_check() {
message info "$message_heading\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
else
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
message warning "$preflight_fail_string$preflight_pass_string"
elif message question "$preflight_fail_string$preflight_pass_string\n\nWould you like configuration issues to be fixed for you?"; then
# Call functions to build fixes for any issues found
for (( i=0; i<"${#preflight_action_funcs[@]}"; i++ )); do
${preflight_action_funcs[i]}
@ -943,25 +1002,6 @@ preflight_check() {
######## begin download functions ##########################################
############################################################################
# Detect if lutris is installed
lutris_detect() {
lutris_installed="false"
lutris_native="false"
lutris_flatpak="false"
# Detect native lutris
if [ -x "$(command -v lutris)" ]; then
lutris_installed="true"
lutris_native="true"
fi
# Detect flatpak lutris
if [ -x "$(command -v flatpak)" ] && flatpak list --app | grep -q Lutris; then
lutris_installed="true"
lutris_flatpak="true"
fi
}
# Restart lutris if necessary
lutris_restart() {
lutris_detect