Compare commits

..

No commits in common. "5cfb3062899c2dc1f855c53adb348df61f39a925" and "02d8f4b6853fff13103b5650c44ac275dac05668" have entirely different histories.

View File

@ -277,6 +277,7 @@ message() {
clear
printf "\n$2\n\n"
read -n 1 -s -p "Press any key..."
return 0
;;
"question")
# question
@ -345,7 +346,7 @@ menu() {
elif [ -z "$cancel_label" ]; then
debug_print exit "Script error: The string 'cancel_label' was not set\nbefore calling the menu function. Aborting."
fi
# Use Zenity if it is available
if [ "$use_zenity" -eq 1 ]; then
# Format the options array for Zenity by adding
@ -361,7 +362,7 @@ menu() {
zen_options+=("${menu_options[i]}")
fi
done
# Display the zenity radio button menu
choice="$(zenity --list --radiolist --width="480" --height="$menu_height" --text="$menu_text_zenity" --title="Star Citizen LUG Helper" --hide-header --cancel-label "$cancel_label" --window-icon="$lug_logo" --column="" --column="Option" "${zen_options[@]}" 2>/dev/null)"
@ -573,25 +574,19 @@ display_dirs() {
fi
# Lutris runners
if [ -d "$runners_dir_native" ] || [ -d "$runners_dir_flatpak" ]; then
dirs_list+="\n\nLutris Runners:"
if [ -d "$runners_dir_native" ]; then
dirs_list+="\n$runners_dir_native"
fi
if [ -d "$runners_dir_flatpak" ]; then
dirs_list+="\n$runners_dir_flatpak"
fi
if [ -d "$runners_dir_native" ]; then
dirs_list+="\n\nLutris Runners:\n$runners_dir_native"
fi
if [ -d "$runners_dir_flatpak" ]; then
dirs_list+="\n\nLutris Runners:\n$runners_dir_flatpak"
fi
# Lutris dxvk
if [ -d "$dxvk_dir_native" ] || [ -d "$dxvk_dir_flatpak" ]; then
dirs_list+="\n\nLutris DXVK Versions:"
if [ -d "$dxvk_dir_native" ]; then
dirs_list+="\n$dxvk_dir_native"
fi
if [ -d "$dxvk_dir_flatpak" ]; then
dirs_list+="\n$dxvk_dir_flatpak"
fi
if [ -d "$dxvk_dir_native" ]; then
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_native"
fi
if [ -d "$dxvk_dir_flatpak" ]; then
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_flatpak"
fi
# Format the info header
@ -962,16 +957,26 @@ lutris_restart() {
lutris_detect
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then
if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then
# Detect which version of Lutris is running and restart it
if [ "$lutris_native" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "/usr/bin/lutris"; then
# Native Lutris is running
debug_print continue "Restarting native Lutris..."
debug_print continue "Restarting Lutris..."
# Detect which version of Lutris is installed
if [ "$lutris_native" = "true" ] && [ "$lutris_flatpak" = "true" ]; then
# Both versions of Lutris are installed so ask the user
if zenity --question --cancel-label="Flatpak" --ok-label="Native" --window-icon="$lug_logo" --text="This Helper has detected both the Native and Flatpak versions of Lutris\nWhich version would you like to use?" --width="400" --title="Star Citizen LUG Helper" 2>/dev/null; then
# Native version
pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
else
# Flatpak version
pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null &
fi
elif [ "$lutris_native" = "true" ]; then
# Native version only
pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
fi
if [ "$lutris_flatpak" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "lutris-wrapper"; then
# Flatpak Lutris is running
debug_print continue "Restarting flatpak Lutris..."
elif [ "$lutris_flatpak" = "true" ]; then
# Flatpak version only
pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null &
else
# We shouldn't get here
debug_print exit "Script error: Unknown condition in lutris_restart function. Aborting."
fi
fi
fi
@ -1549,8 +1554,7 @@ runner_manage() {
missing_dir="false"
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
if [ ! -d "${download_dirs[i]}" ]; then
message warning "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
debug_print continue "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
message info "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
missing_dir="true"
fi
done
@ -1605,8 +1609,7 @@ dxvk_manage() {
missing_dir="false"
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
if [ ! -d "${download_dirs[i]}" ]; then
message warning "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
debug_print continue "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
message info "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
missing_dir="true"
fi
done
@ -1661,7 +1664,7 @@ eac_workaround() {
else
message info "The Easy Anti-Cheat workaround has already been applied, but may be commented out.\nNo changes have been made, please edit /etc/hosts manually."
fi
return 0
return 1
fi
# Configure message variables
@ -1714,30 +1717,20 @@ install_game() {
# Both versions of Lutris are installed so ask the user
if zenity --question --cancel-label="Flatpak" --ok-label="Native" --window-icon="$lug_logo" --text="This Helper has detected both the Native and Flatpak versions of Lutris\nWhich version would you like to use?" --width="400" --title="Star Citizen LUG Helper" 2>/dev/null; then
# Native version
install_version="native"
lutris --install "$install_script" &
else
# Flatpak version
install_version="flatpak"
flatpak run net.lutris.Lutris --install "$install_script" &
fi
elif [ "$lutris_native" = "true" ]; then
# Native version only
install_version="native"
lutris --install "$install_script" &
elif [ "$lutris_flatpak" = "true" ]; then
# Flatpak version only
install_version="flatpak"
else
# We shouldn't get here
debug_print exit "Script error: Unable to detect Lutris version in install_game function. Aborting."
fi
# Run the appropriate installer
if [ "$install_version" = "native" ]; then
lutris --install "$install_script" &
elif [ "$install_version" = "flatpak" ]; then
flatpak run net.lutris.Lutris --install "$install_script" &
else
# We shouldn't get here
debug_print exit "Script error: Unknown condition for install_version in install_game() function. Aborting."
debug_print exit "Script error: Unknown condition in install_game function. Aborting."
fi
message info "The installation will continue in Lutris"
fi
@ -1898,22 +1891,6 @@ fi
# Set defaults
live_or_ptu="$live_dir"
# Format some URLs for Zenity
if [ "$use_zenity" -eq 1 ]; then
releases_url="<a href='$releases_url'>$releases_url</a>"
lug_wiki="<a href='$lug_wiki'>$lug_wiki</a>"
fi
# Check if a newer verison of the script is available
latest_version="$(get_latest_release "$repo")"
# Sort the versions and check if the installed Helper is smaller
if [ "$latest_version" != "$current_version" ] &&
[ "$current_version" = "$(printf "$current_version\n$latest_version" | sort -V | head -n1)" ]; then
message info "The latest version of the LUG Helper is $latest_version\nYou are using $current_version\n\nYou can download new releases here:\n$releases_url"
fi
# If invoked with command line arguments, process them and exit
if [ "$#" -gt 0 ]; then
while [ "$#" -gt 0 ]
@ -1925,17 +1902,15 @@ if [ "$#" -gt 0 ]; then
Usage: lug-helper <options>
-p, --preflight-check Run system optimization checks
-i, --install Install Star Citizen
-e, --eac Deploy Easy Anti-Cheat Workaround
-m, --manage-runners Install or remove Lutris runners
-k, --manage-dxvk Install or remove DXVK versions
-u, --delete-user-folder Delete Star Citizen USER folder, preserving keybinds
-s, --delete-shaders Delete Star Citizen shaders
-s, --delete-shaders Delete Star Citizen shaders directory
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
-t, --target=[live|ptu] Target LIVE or PTU (default live)
-g, --use-gui=[yes|no] Use Zenity GUI if available (default yes)
-r, --get-referral Get a random LUG member's Star Citizen referral code
-d, --show-directories Show all Star Citizen and LUG Helper directories
-w, --show-wiki Show the LUG Wiki
-x, --reset-helper Delete saved lug-helper configs
"
exit 0
@ -1946,9 +1921,6 @@ Usage: lug-helper <options>
--install | -i )
cargs+=("install_game")
;;
--eac | -e )
cargs+=("eac_workaround")
;;
--manage-runners | -m )
cargs+=("runner_manage")
;;
@ -1996,9 +1968,6 @@ Usage: lug-helper <options>
--show-directories | -d )
cargs+=("display_dirs")
;;
--show-wiki | -w )
cargs+=("display_wiki")
;;
--reset-helper | -x )
cargs+=("reset_helper")
;;
@ -2013,13 +1982,29 @@ Usage: lug-helper <options>
# Call the requested functions and exit
if [ "${#cargs[@]}" -gt 0 ]; then
for (( x=0; x<"${#cargs[@]}"; x++ )); do
${cargs[x]}
for (( i=0; i<"${#cargs[@]}"; i++ )); do
${cargs[i]}
done
exit 0
fi
fi
# Format some URLs for Zenity
if [ "$use_zenity" -eq 1 ]; then
releases_url="<a href='$releases_url'>$releases_url</a>"
lug_wiki="<a href='$lug_wiki'>$lug_wiki</a>"
fi
# Check if a newer verison of the script is available
latest_version="$(get_latest_release "$repo")"
# Sort the versions and check if the installed Helper is smaller
if [ "$latest_version" != "$current_version" ] &&
[ "$current_version" = "$(printf "$current_version\n$latest_version" | sort -V | head -n1)" ]; then
message info "The latest version of the LUG Helper is $latest_version\nYou are using $current_version\n\nYou can download new releases here:\n$releases_url"
fi
# Loop the main menu until the user selects quit
while true; do
# Configure the menu