Compare commits

..

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

View File

@ -277,6 +277,7 @@ message() {
clear clear
printf "\n$2\n\n" printf "\n$2\n\n"
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
return 0
;; ;;
"question") "question")
# question # question
@ -573,25 +574,19 @@ display_dirs() {
fi fi
# Lutris runners # Lutris runners
if [ -d "$runners_dir_native" ] || [ -d "$runners_dir_flatpak" ]; then
dirs_list+="\n\nLutris Runners:"
if [ -d "$runners_dir_native" ]; then if [ -d "$runners_dir_native" ]; then
dirs_list+="\n$runners_dir_native" dirs_list+="\n\nLutris Runners:\n$runners_dir_native"
fi fi
if [ -d "$runners_dir_flatpak" ]; then if [ -d "$runners_dir_flatpak" ]; then
dirs_list+="\n$runners_dir_flatpak" dirs_list+="\n\nLutris Runners:\n$runners_dir_flatpak"
fi
fi fi
# Lutris dxvk # Lutris dxvk
if [ -d "$dxvk_dir_native" ] || [ -d "$dxvk_dir_flatpak" ]; then
dirs_list+="\n\nLutris DXVK Versions:"
if [ -d "$dxvk_dir_native" ]; then if [ -d "$dxvk_dir_native" ]; then
dirs_list+="\n$dxvk_dir_native" dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_native"
fi fi
if [ -d "$dxvk_dir_flatpak" ]; then if [ -d "$dxvk_dir_flatpak" ]; then
dirs_list+="\n$dxvk_dir_flatpak" dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_flatpak"
fi
fi fi
# Format the info header # Format the info header
@ -962,17 +957,27 @@ lutris_restart() {
lutris_detect lutris_detect
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then 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 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 debug_print continue "Restarting Lutris..."
if [ "$lutris_native" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "/usr/bin/lutris"; then # Detect which version of Lutris is installed
# Native Lutris is running if [ "$lutris_native" = "true" ] && [ "$lutris_flatpak" = "true" ]; then
debug_print continue "Restarting native Lutris..." # 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 & pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
fi else
if [ "$lutris_flatpak" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "lutris-wrapper"; then # Flatpak version
# Flatpak Lutris is running
debug_print continue "Restarting flatpak Lutris..."
pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null & pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null &
fi fi
elif [ "$lutris_native" = "true" ]; then
# Native version only
pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
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
fi fi
lutris_needs_restart="false" lutris_needs_restart="false"
@ -1549,8 +1554,7 @@ runner_manage() {
missing_dir="false" missing_dir="false"
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
if [ ! -d "${download_dirs[i]}" ]; then if [ ! -d "${download_dirs[i]}" ]; then
message warning "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]}"
debug_print continue "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
missing_dir="true" missing_dir="true"
fi fi
done done
@ -1605,8 +1609,7 @@ dxvk_manage() {
missing_dir="false" missing_dir="false"
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
if [ ! -d "${download_dirs[i]}" ]; then if [ ! -d "${download_dirs[i]}" ]; then
message warning "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]}"
debug_print continue "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
missing_dir="true" missing_dir="true"
fi fi
done done
@ -1661,7 +1664,7 @@ eac_workaround() {
else 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." 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 fi
return 0 return 1
fi fi
# Configure message variables # Configure message variables
@ -1714,30 +1717,20 @@ install_game() {
# Both versions of Lutris are installed so ask the user # 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 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 # Native version
install_version="native" lutris --install "$install_script" &
else else
# Flatpak version # Flatpak version
install_version="flatpak" flatpak run net.lutris.Lutris --install "$install_script" &
fi fi
elif [ "$lutris_native" = "true" ]; then elif [ "$lutris_native" = "true" ]; then
# Native version only # Native version only
install_version="native" lutris --install "$install_script" &
elif [ "$lutris_flatpak" = "true" ]; then elif [ "$lutris_flatpak" = "true" ]; then
# Flatpak version only # 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" & flatpak run net.lutris.Lutris --install "$install_script" &
else else
# We shouldn't get here # 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 fi
message info "The installation will continue in Lutris" message info "The installation will continue in Lutris"
fi fi
@ -1898,22 +1891,6 @@ fi
# Set defaults # Set defaults
live_or_ptu="$live_dir" 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 invoked with command line arguments, process them and exit
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -1925,17 +1902,15 @@ if [ "$#" -gt 0 ]; then
Usage: lug-helper <options> Usage: lug-helper <options>
-p, --preflight-check Run system optimization checks -p, --preflight-check Run system optimization checks
-i, --install Install Star Citizen -i, --install Install Star Citizen
-e, --eac Deploy Easy Anti-Cheat Workaround
-m, --manage-runners Install or remove Lutris runners -m, --manage-runners Install or remove Lutris runners
-k, --manage-dxvk Install or remove DXVK versions -k, --manage-dxvk Install or remove DXVK versions
-u, --delete-user-folder Delete Star Citizen USER folder, preserving keybinds -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 -c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
-t, --target=[live|ptu] Target LIVE or PTU (default live) -t, --target=[live|ptu] Target LIVE or PTU (default live)
-g, --use-gui=[yes|no] Use Zenity GUI if available (default yes) -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 -r, --get-referral Get a random LUG member's Star Citizen referral code
-d, --show-directories Show all Star Citizen and LUG Helper directories -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 -x, --reset-helper Delete saved lug-helper configs
" "
exit 0 exit 0
@ -1946,9 +1921,6 @@ Usage: lug-helper <options>
--install | -i ) --install | -i )
cargs+=("install_game") cargs+=("install_game")
;; ;;
--eac | -e )
cargs+=("eac_workaround")
;;
--manage-runners | -m ) --manage-runners | -m )
cargs+=("runner_manage") cargs+=("runner_manage")
;; ;;
@ -1996,9 +1968,6 @@ Usage: lug-helper <options>
--show-directories | -d ) --show-directories | -d )
cargs+=("display_dirs") cargs+=("display_dirs")
;; ;;
--show-wiki | -w )
cargs+=("display_wiki")
;;
--reset-helper | -x ) --reset-helper | -x )
cargs+=("reset_helper") cargs+=("reset_helper")
;; ;;
@ -2013,13 +1982,29 @@ Usage: lug-helper <options>
# Call the requested functions and exit # Call the requested functions and exit
if [ "${#cargs[@]}" -gt 0 ]; then if [ "${#cargs[@]}" -gt 0 ]; then
for (( x=0; x<"${#cargs[@]}"; x++ )); do for (( i=0; i<"${#cargs[@]}"; i++ )); do
${cargs[x]} ${cargs[i]}
done done
exit 0 exit 0
fi fi
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 # Loop the main menu until the user selects quit
while true; do while true; do
# Configure the menu # Configure the menu