From f78f54ddf75a4c042bb264f33664bf1c00fa5ec2 Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Tue, 18 Oct 2022 11:12:14 -0400 Subject: [PATCH] Put lutris detection in its own function Preparation for flatpak support --- lug-helper.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index 0d74b72..98cb5a7 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -917,6 +917,14 @@ preflight_check() { #------------------------- begin download functions ----------------------------# +# Detect if lutris is installed +lutris_detect() { + if [ ! -x "$(command -v lutris)" ]; then + # Standard Lutris is not installed + return 1 + fi +} + # Restart lutris if necessary lutris_restart() { if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then @@ -1330,8 +1338,9 @@ download_manage() { debug_print exit "Script error: The download_manage function expects a string argument. Aborting." fi # Check if Lutris is installed - if [ ! -x "$(command -v lutris)" ]; then - message info "Lutris does not appear to be installed." + lutris_detect + if [ "$?" -eq 1 ]; then + message warning "Lutris is required but does not appear to be installed." return 0 fi if [ ! -d "$download_dir" ]; then @@ -1512,7 +1521,8 @@ eac_workaround() { # Install Star Citizen using Lutris install_game() { # Check if Lutris is installed - if [ ! -x "$(command -v lutris)" ]; then + lutris_detect + if [ "$?" -eq 1 ]; then message warning "Lutris is required but does not appear to be installed." return 0 fi