mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 15:44:20 +00:00
Improve lutris install and restart functions
This commit is contained in:
parent
02d8f4b685
commit
bd119c4ce8
@ -346,7 +346,7 @@ menu() {
|
|||||||
elif [ -z "$cancel_label" ]; then
|
elif [ -z "$cancel_label" ]; then
|
||||||
debug_print exit "Script error: The string 'cancel_label' was not set\nbefore calling the menu function. Aborting."
|
debug_print exit "Script error: The string 'cancel_label' was not set\nbefore calling the menu function. Aborting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use Zenity if it is available
|
# Use Zenity if it is available
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Format the options array for Zenity by adding
|
# Format the options array for Zenity by adding
|
||||||
@ -362,7 +362,7 @@ menu() {
|
|||||||
zen_options+=("${menu_options[i]}")
|
zen_options+=("${menu_options[i]}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Display the zenity radio button menu
|
# 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)"
|
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)"
|
||||||
|
|
||||||
@ -957,26 +957,16 @@ 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
|
||||||
debug_print continue "Restarting Lutris..."
|
# Detect which version of Lutris is running and restart it
|
||||||
# Detect which version of Lutris is installed
|
if [ "$lutris_native" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "/usr/bin/lutris"; then
|
||||||
if [ "$lutris_native" = "true" ] && [ "$lutris_flatpak" = "true" ]; then
|
# Native Lutris is running
|
||||||
# Both versions of Lutris are installed so ask the user
|
debug_print continue "Restarting native Lutris..."
|
||||||
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 &
|
pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
|
||||||
elif [ "$lutris_flatpak" = "true" ]; then
|
fi
|
||||||
# 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 &
|
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
|
fi
|
||||||
@ -1717,20 +1707,30 @@ 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
|
||||||
lutris --install "$install_script" &
|
install_version="native"
|
||||||
else
|
else
|
||||||
# Flatpak version
|
# Flatpak version
|
||||||
flatpak run net.lutris.Lutris --install "$install_script" &
|
install_version="flatpak"
|
||||||
fi
|
fi
|
||||||
elif [ "$lutris_native" = "true" ]; then
|
elif [ "$lutris_native" = "true" ]; then
|
||||||
# Native version only
|
# Native version only
|
||||||
lutris --install "$install_script" &
|
install_version="native"
|
||||||
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 in install_game function. Aborting."
|
debug_print exit "Script error: Unknown condition for install_version 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
|
||||||
|
Loading…
Reference in New Issue
Block a user