From 57267032b0eb92cdf56a06d5d3986c21471cecd2 Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Sun, 8 Sep 2024 14:51:51 -0400 Subject: [PATCH] Update first run experience for new install options --- lug-helper.sh | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index 0a250b6..13619f6 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -326,7 +326,7 @@ try_exec() { message() { # Sanity check if [ "$#" -lt 2 ]; then - debug_print exit "Script error: The message function expects two arguments. Aborting." + debug_print exit "Script error: The message function expects at least two arguments. Aborting." fi # Use zenity messages if available @@ -415,6 +415,24 @@ message() { esac done ;; + "options") + # Choose from two options + # call format: if message options left_button_name right_button_name "which one do you want?"; then... + printf "\n$4\n1: $3\n2: $2\n" + while read -p "[1/2]: " option; do + case "$option" in + 1*) + return 0 + ;; + 2*) + return 1 + ;; + *) + printf "Please type '1' or '2'\n" + ;; + esac + done + ;; *) debug_print exit "Script Error: Invalid message type passed to the message function. Aborting." ;; @@ -2419,7 +2437,7 @@ install_game_lutris() { install_version="flatpak" else # We shouldn't get here - debug_print exit "Script error: Unable to detect Lutris version in install_game function. Aborting." + debug_print exit "Script error: Unable to detect Lutris version in install_game_lutris function. Aborting." fi # Run the appropriate installer @@ -2429,7 +2447,7 @@ install_game_lutris() { flatpak run --file-forwarding net.lutris.Lutris --install @@ "$lutris_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 for install_version in install_game_lutris() function. Aborting." fi message info "The installation will continue in Lutris" @@ -2835,10 +2853,13 @@ if [ "$use_zenity" -eq 1 ]; then else firstrun_message="$menu_heading_terminal\n\n$firstrun_message" fi -if [ "$is_firstrun" = "true" ]; then +if [ "$is_firstrun" = "false" ]; then if message question "$firstrun_message"; then - preflight_check - install_game + if message options "Wine" "Lutris" "Which install method would you like to use?"; then + install_game_lutris + else + install_game_wine + fi fi # Store the first run state for subsequent launches if [ ! -d "$conf_dir/$conf_subdir" ]; then