mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-15 18:50:36 +00:00
Compare commits
10 Commits
02d8f4b685
...
5cfb306289
Author | SHA1 | Date | |
---|---|---|---|
|
5cfb306289 | ||
|
80017b848e | ||
|
80db33be07 | ||
|
c497f8e1d8 | ||
|
eedb5de460 | ||
|
3a7e0996b5 | ||
|
402b22ea45 | ||
|
10812a622d | ||
|
f5abb87cb5 | ||
|
bd119c4ce8 |
111
lug-helper.sh
111
lug-helper.sh
@ -277,7 +277,6 @@ message() {
|
||||
clear
|
||||
printf "\n$2\n\n"
|
||||
read -n 1 -s -p "Press any key..."
|
||||
return 0
|
||||
;;
|
||||
"question")
|
||||
# question
|
||||
@ -574,19 +573,25 @@ 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\nLutris Runners:\n$runners_dir_native"
|
||||
dirs_list+="\n$runners_dir_native"
|
||||
fi
|
||||
if [ -d "$runners_dir_flatpak" ]; then
|
||||
dirs_list+="\n\nLutris Runners:\n$runners_dir_flatpak"
|
||||
dirs_list+="\n$runners_dir_flatpak"
|
||||
fi
|
||||
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\nLutris DXVK Versions:\n$dxvk_dir_native"
|
||||
dirs_list+="\n$dxvk_dir_native"
|
||||
fi
|
||||
if [ -d "$dxvk_dir_flatpak" ]; then
|
||||
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_flatpak"
|
||||
dirs_list+="\n$dxvk_dir_flatpak"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Format the info header
|
||||
@ -957,26 +962,16 @@ 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
|
||||
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
|
||||
# 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..."
|
||||
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 &
|
||||
elif [ "$lutris_flatpak" = "true" ]; then
|
||||
# Flatpak version only
|
||||
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..."
|
||||
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
|
||||
@ -1554,7 +1549,8 @@ runner_manage() {
|
||||
missing_dir="false"
|
||||
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
|
||||
if [ ! -d "${download_dirs[i]}" ]; then
|
||||
message info "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
|
||||
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]}"
|
||||
missing_dir="true"
|
||||
fi
|
||||
done
|
||||
@ -1609,7 +1605,8 @@ dxvk_manage() {
|
||||
missing_dir="false"
|
||||
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
|
||||
if [ ! -d "${download_dirs[i]}" ]; then
|
||||
message info "The following Lutris directory was not found. Unable to continue.\n\n${download_dirs[i]}"
|
||||
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]}"
|
||||
missing_dir="true"
|
||||
fi
|
||||
done
|
||||
@ -1664,7 +1661,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 1
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Configure message variables
|
||||
@ -1717,20 +1714,30 @@ 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
|
||||
lutris --install "$install_script" &
|
||||
install_version="native"
|
||||
else
|
||||
# Flatpak version
|
||||
flatpak run net.lutris.Lutris --install "$install_script" &
|
||||
install_version="flatpak"
|
||||
fi
|
||||
elif [ "$lutris_native" = "true" ]; then
|
||||
# Native version only
|
||||
lutris --install "$install_script" &
|
||||
install_version="native"
|
||||
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 in install_game function. Aborting."
|
||||
debug_print exit "Script error: Unknown condition for install_version in install_game() function. Aborting."
|
||||
fi
|
||||
message info "The installation will continue in Lutris"
|
||||
fi
|
||||
@ -1891,6 +1898,22 @@ 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 ]
|
||||
@ -1902,15 +1925,17 @@ 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 directory
|
||||
-s, --delete-shaders Delete Star Citizen shaders
|
||||
-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
|
||||
@ -1921,6 +1946,9 @@ Usage: lug-helper <options>
|
||||
--install | -i )
|
||||
cargs+=("install_game")
|
||||
;;
|
||||
--eac | -e )
|
||||
cargs+=("eac_workaround")
|
||||
;;
|
||||
--manage-runners | -m )
|
||||
cargs+=("runner_manage")
|
||||
;;
|
||||
@ -1968,6 +1996,9 @@ Usage: lug-helper <options>
|
||||
--show-directories | -d )
|
||||
cargs+=("display_dirs")
|
||||
;;
|
||||
--show-wiki | -w )
|
||||
cargs+=("display_wiki")
|
||||
;;
|
||||
--reset-helper | -x )
|
||||
cargs+=("reset_helper")
|
||||
;;
|
||||
@ -1982,29 +2013,13 @@ Usage: lug-helper <options>
|
||||
|
||||
# Call the requested functions and exit
|
||||
if [ "${#cargs[@]}" -gt 0 ]; then
|
||||
for (( i=0; i<"${#cargs[@]}"; i++ )); do
|
||||
${cargs[i]}
|
||||
for (( x=0; x<"${#cargs[@]}"; x++ )); do
|
||||
${cargs[x]}
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user