mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 17:34:23 +00:00
Add support for Flatpak Lutris
This commit is contained in:
parent
1844bfda13
commit
6a665bceac
289
lug-helper.sh
289
lug-helper.sh
@ -118,8 +118,11 @@ shaders_subdir="shaders"
|
|||||||
|
|
||||||
######## Runners ###########################################################
|
######## Runners ###########################################################
|
||||||
|
|
||||||
# Lutris wine runners directory
|
# Lutris native wine runners directory
|
||||||
runners_dir="$data_dir/lutris/runners/wine"
|
runners_dir_native="$data_dir/lutris/runners/wine"
|
||||||
|
# Lutris flatpak wine runners directory
|
||||||
|
runners_dir_flatpak="$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine"
|
||||||
|
|
||||||
# URLs for downloading Lutris runners
|
# URLs for downloading Lutris runners
|
||||||
# Elements in this array must be added in quoted pairs of: "description" "url"
|
# Elements in this array must be added in quoted pairs of: "description" "url"
|
||||||
# The first string in the pair is expected to contain the runner description
|
# The first string in the pair is expected to contain the runner description
|
||||||
@ -133,8 +136,11 @@ runner_sources=(
|
|||||||
|
|
||||||
######## DXVK ##############################################################
|
######## DXVK ##############################################################
|
||||||
|
|
||||||
# Lutris dxvk directory
|
# Lutris native dxvk directory
|
||||||
dxvk_dir="$data_dir/lutris/runtime/dxvk"
|
dxvk_dir_native="$data_dir/lutris/runtime/dxvk"
|
||||||
|
# Lutris flatpak dxvk directory
|
||||||
|
dxvk_dir_flatpak="$HOME/.var/app/net.lutris.Lutris/data/lutris/runtime/dxvk"
|
||||||
|
|
||||||
# URLs for downloading dxvk versions
|
# URLs for downloading dxvk versions
|
||||||
# Elements in this array must be added in quoted pairs of: "description" "url"
|
# Elements in this array must be added in quoted pairs of: "description" "url"
|
||||||
# The first string in the pair is expected to contain the runner description
|
# The first string in the pair is expected to contain the runner description
|
||||||
@ -545,7 +551,7 @@ getdirs() {
|
|||||||
|
|
||||||
# Display all directories currently used by this helper and Star Citizen
|
# Display all directories currently used by this helper and Star Citizen
|
||||||
display_dirs() {
|
display_dirs() {
|
||||||
declare -a dirs_list
|
unset dirs_list
|
||||||
|
|
||||||
# Helper configs and keybinds
|
# Helper configs and keybinds
|
||||||
if [ -d "$conf_dir/$conf_subdir" ]; then
|
if [ -d "$conf_dir/$conf_subdir" ]; then
|
||||||
@ -568,13 +574,19 @@ display_dirs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Lutris runners
|
# Lutris runners
|
||||||
if [ -d "$runners_dir" ]; then
|
if [ -d "$runners_dir_native" ]; then
|
||||||
dirs_list+="\n\nLutris Runners:\n$runners_dir"
|
dirs_list+="\n\nLutris Runners:\n$runners_dir_native"
|
||||||
|
fi
|
||||||
|
if [ -d "$runners_dir_flatpak" ]; then
|
||||||
|
dirs_list+="\n\nLutris Runners:\n$runners_dir_flatpak"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Lutris dxvk
|
# Lutris dxvk
|
||||||
if [ -d "$runners_dir" ]; then
|
if [ -d "$dxvk_dir_native" ]; then
|
||||||
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir"
|
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_native"
|
||||||
|
fi
|
||||||
|
if [ -d "$dxvk_dir_flatpak" ]; then
|
||||||
|
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir_flatpak"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format the info header
|
# Format the info header
|
||||||
@ -920,14 +932,14 @@ preflight_check() {
|
|||||||
# Detect if lutris is installed
|
# Detect if lutris is installed
|
||||||
lutris_detect() {
|
lutris_detect() {
|
||||||
lutris_installed="false"
|
lutris_installed="false"
|
||||||
lutris_standard="false"
|
lutris_native="false"
|
||||||
lutris_flatpak="false"
|
lutris_flatpak="false"
|
||||||
|
|
||||||
# Detect standard lutris
|
# Detect native lutris
|
||||||
if [ -x "$(command -v lutris)" ]; then
|
if [ -x "$(command -v lutris)" ]; then
|
||||||
# Standard Lutris is installed
|
# Native Lutris is installed
|
||||||
lutris_installed="true"
|
lutris_installed="true"
|
||||||
lutris_standard="true"
|
lutris_native="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect flatpak lutris
|
# Detect flatpak lutris
|
||||||
@ -951,6 +963,50 @@ lutris_restart() {
|
|||||||
lutris_needs_restart="false"
|
lutris_needs_restart="false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get an array of directories used by Lutris
|
||||||
|
# Supports native install and flatpak
|
||||||
|
# Array must be formatted in pairs of ("[type]" "[directory]")
|
||||||
|
# Takes an argument to specify the type to return, ie "runner" or "dxvk"
|
||||||
|
get_lutris_dirs() {
|
||||||
|
# Sanity check
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
debug_print exit "Script error: The get_lutris_dirs function expects one argument. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Detect the type of Lutris install
|
||||||
|
lutris_detect
|
||||||
|
|
||||||
|
# Add lutris directories to an array
|
||||||
|
unset lutris_dirs
|
||||||
|
case "$1" in
|
||||||
|
"runner")
|
||||||
|
# Native Lutris install
|
||||||
|
if [ "$lutris_native" = "true" ]; then
|
||||||
|
lutris_dirs+=("native" "$runners_dir_native")
|
||||||
|
fi
|
||||||
|
# Flatpak lutris install
|
||||||
|
if [ "$lutris_flatpak" = "true" ]; then
|
||||||
|
lutris_dirs+=("flatpak" "$runners_dir_flatpak")
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"dxvk")
|
||||||
|
# Native Lutris install
|
||||||
|
if [ "$lutris_native" = "true" ]; then
|
||||||
|
lutris_dirs+=("native" "$dxvk_dir_native")
|
||||||
|
fi
|
||||||
|
# Flatpak lutris install
|
||||||
|
if [ "$lutris_flatpak" = "true" ]; then
|
||||||
|
lutris_dirs+=("flatpak" "$dxvk_dir_flatpak")
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "lug-helper.sh: Unknown argument provided to get_lutris_dirs function. Aborting.\n" 1>&2
|
||||||
|
read -n 1 -s -p "Press any key..."
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Perform post-download actions, display messages or instructions
|
# Perform post-download actions, display messages or instructions
|
||||||
# Expects the variables message_heading, post_download_msg_text,
|
# Expects the variables message_heading, post_download_msg_text,
|
||||||
# post_download_msg_italics, and downloaded_item_name
|
# post_download_msg_italics, and downloaded_item_name
|
||||||
@ -989,10 +1045,10 @@ post_download() {
|
|||||||
display_post_download_msg="false"
|
display_post_download_msg="false"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Uninstall the selected item
|
# Uninstall the selected item. Called by download_select_install()
|
||||||
|
# Note: The array installed_items is expected to be set before calling this function
|
||||||
download_delete() {
|
download_delete() {
|
||||||
# This function expects an index number for the array
|
# This function expects an index number for the array installed_items to be passed in as an argument
|
||||||
# installed_items to be passed in as an argument
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
debug_print exit "Script error: The download_delete function expects an argument. Aborting."
|
debug_print exit "Script error: The download_delete function expects an argument. Aborting."
|
||||||
fi
|
fi
|
||||||
@ -1005,7 +1061,7 @@ download_delete() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# List installed items for deletion
|
# List installed items for deletion. Called by download_manage()
|
||||||
download_select_delete() {
|
download_select_delete() {
|
||||||
# Configure the menu
|
# Configure the menu
|
||||||
menu_text_zenity="Select the $download_type you want to remove:"
|
menu_text_zenity="Select the $download_type you want to remove:"
|
||||||
@ -1013,19 +1069,31 @@ download_select_delete() {
|
|||||||
menu_text_height="65"
|
menu_text_height="65"
|
||||||
goback="Return to the $download_type management menu"
|
goback="Return to the $download_type management menu"
|
||||||
unset installed_items
|
unset installed_items
|
||||||
|
unset installed_item_names
|
||||||
unset menu_options
|
unset menu_options
|
||||||
unset menu_actions
|
unset menu_actions
|
||||||
|
|
||||||
# Create an array containing all directories in the download_dir
|
# Find all installed items in the download destinations
|
||||||
for items_list in "$download_dir"/*; do
|
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
|
||||||
if [ -d "$items_list" ]; then
|
# Loop through all download destinations
|
||||||
installed_items+=("$items_list")
|
# Odd numbered elements will contain the download destination's path
|
||||||
fi
|
for item in "${download_dirs[i]}"/*; do
|
||||||
|
if [ -d "$item" ]; then
|
||||||
|
if [ "${#download_dirs[@]}" -eq 2 ]; then
|
||||||
|
# We're deleting from one location
|
||||||
|
installed_item_names+=("$(basename "$item")")
|
||||||
|
else
|
||||||
|
# We're deleting from multiple locations so label each one
|
||||||
|
installed_item_names+=("$(basename "$item [${download_dirs[i-1]}]")")
|
||||||
|
fi
|
||||||
|
installed_items+=("$item")
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create menu options for the installed items
|
# Create menu options for the installed items
|
||||||
for (( i=0; i<"${#installed_items[@]}"; i++ )); do
|
for (( i=0; i<"${#installed_items[@]}"; i++ )); do
|
||||||
menu_options+=("$(basename "${installed_items[i]}")")
|
menu_options+=("${installed_item_names[i]}")
|
||||||
menu_actions+=("download_delete $i")
|
menu_actions+=("download_delete $i")
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -1046,9 +1114,8 @@ download_select_delete() {
|
|||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download and install the selected item
|
# Download and install the selected item. Called by download_select_install()
|
||||||
# Note: The variables download_versions, contributor_url, and download_url_type
|
# Note: The variables download_versions, contributor_url, and download_url_type are expected to be set before calling this function
|
||||||
# are expected to be set before calling this function
|
|
||||||
download_install() {
|
download_install() {
|
||||||
# This function expects an index number for the array
|
# This function expects an index number for the array
|
||||||
# download_versions to be passed in as an argument
|
# download_versions to be passed in as an argument
|
||||||
@ -1080,12 +1147,6 @@ download_install() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if this file has already been installed
|
|
||||||
if [ -d "$download_dir/$download_name" ]; then
|
|
||||||
message info "The selected $download_type is already installed:\n\n$download_name"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the selected download url
|
# Get the selected download url
|
||||||
# To add new sources, handle them here and in the
|
# To add new sources, handle them here and in the
|
||||||
# download_select_install function below
|
# download_select_install function below
|
||||||
@ -1163,14 +1224,25 @@ download_install() {
|
|||||||
# If the archive contains only one directory, install that directory
|
# If the archive contains only one directory, install that directory
|
||||||
# We rename it to the name of the archive in case it is different
|
# We rename it to the name of the archive in case it is different
|
||||||
# so we can easily detect installed items in download_select_install()
|
# so we can easily detect installed items in download_select_install()
|
||||||
debug_print continue "Installing $download_type into $download_dir/$download_name..."
|
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
# Loop through all download destinations, installing to each one
|
||||||
# Use Zenity progress bar
|
# Odd numbered elements will contain the download destination's path
|
||||||
mkdir -p "$download_dir" && cp -r "$tmp_dir/$download_name/$extracted_dir" "$download_dir/$download_name" | \
|
if [ -d "${download_dirs[i]}/$download_name" ]; then
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null
|
# This item has already been installed. Delete it before reinstalling
|
||||||
else
|
debug_print continue "$download_type exists, deleting ${download_dirs[i]}/$download_name..."
|
||||||
mkdir -p "$download_dir" && cp -r "$tmp_dir/$download_name/$extracted_dir" "$download_dir/$download_name"
|
rm -r "${download_dirs[i]}/$download_name"
|
||||||
fi
|
debug_print continue "Reinstalling $download_type into ${download_dirs[i]}/$download_name..."
|
||||||
|
else
|
||||||
|
debug_print continue "Installing $download_type into ${download_dirs[i]}/$download_name..."
|
||||||
|
fi
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
# Use Zenity progress bar
|
||||||
|
mkdir -p "${download_dirs[i]}" && cp -r "$tmp_dir/$download_name/$extracted_dir" "${download_dirs[i]}/$download_name" | \
|
||||||
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p "${download_dirs[i]}" && cp -r "$tmp_dir/$download_name/$extracted_dir" "${download_dirs[i]}/$download_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# We need to restart Lutris for the download to be detected
|
# We need to restart Lutris for the download to be detected
|
||||||
lutris_needs_restart="true"
|
lutris_needs_restart="true"
|
||||||
@ -1181,14 +1253,25 @@ download_install() {
|
|||||||
elif [ "$num_dirs" -gt 1 ] || [ "$num_files" -gt 0 ]; then
|
elif [ "$num_dirs" -gt 1 ] || [ "$num_files" -gt 0 ]; then
|
||||||
# If the archive contains more than one directory or
|
# If the archive contains more than one directory or
|
||||||
# one or more files, we must create a subdirectory
|
# one or more files, we must create a subdirectory
|
||||||
debug_print continue "Installing $download_type into $download_dir/$download_name..."
|
for (( i=1; i<"${#download_dirs[@]}"; i=i+2 )); do
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
# Loop through all download destinations, installing to each one
|
||||||
# Use Zenity progress bar
|
# Odd numbered elements will contain the download destination's path
|
||||||
mkdir -p "$download_dir/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"/"$download_name" | \
|
if [ -d "${download_dirs[i]}/$download_name" ]; then
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null
|
# This item has already been installed. Delete it before reinstalling
|
||||||
else
|
debug_print continue "$download_type exists, deleting ${download_dirs[i]}/$download_name..."
|
||||||
mkdir -p "$download_dir/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"/"$download_name"
|
rm -r "${download_dirs[i]}/$download_name"
|
||||||
fi
|
debug_print continue "Reinstalling $download_type into ${download_dirs[i]}/$download_name..."
|
||||||
|
else
|
||||||
|
debug_print continue "Installing $download_type into ${download_dirs[i]}/$download_name..."
|
||||||
|
fi
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
# Use Zenity progress bar
|
||||||
|
mkdir -p "${download_dirs[i]}/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "${download_dirs[i]}"/"$download_name" | \
|
||||||
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p "${download_dirs[i]}/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "${download_dirs[i]}"/"$download_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# We need to restart Lutris for the download to be detected
|
# We need to restart Lutris for the download to be detected
|
||||||
lutris_needs_restart="true"
|
lutris_needs_restart="true"
|
||||||
@ -1208,7 +1291,7 @@ download_install() {
|
|||||||
rm -r "$tmp_dir/$download_name"
|
rm -r "$tmp_dir/$download_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
# List available items for download
|
# List available items for download. Called by download_manage()
|
||||||
download_select_install() {
|
download_select_install() {
|
||||||
# This function expects an element number for the sources array
|
# This function expects an element number for the sources array
|
||||||
# to be passed in as an argument
|
# to be passed in as an argument
|
||||||
@ -1267,7 +1350,7 @@ download_select_install() {
|
|||||||
goback="Return to the $download_type management menu"
|
goback="Return to the $download_type management menu"
|
||||||
unset menu_options
|
unset menu_options
|
||||||
unset menu_actions
|
unset menu_actions
|
||||||
|
|
||||||
# Iterate through the versions, check if they are installed,
|
# Iterate through the versions, check if they are installed,
|
||||||
# and add them to the menu options
|
# and add them to the menu options
|
||||||
# To add new file extensions, handle them here and in
|
# To add new file extensions, handle them here and in
|
||||||
@ -1298,12 +1381,44 @@ download_select_install() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Add the file names to the menu
|
# Create a list of locations where the file is already installed
|
||||||
if [ -d "$download_dir/$download_name" ]; then
|
unset installed_types
|
||||||
menu_options+=("$download_name [installed]")
|
for (( j=0; j<"${#download_dirs[@]}"; j=j+2 )); do
|
||||||
|
# Loop through all download destinations to get installed types
|
||||||
|
# Even numbered elements will contain the download destination type (ie. native/flatpak)
|
||||||
|
if [ -d "${download_dirs[j+1]}/$download_name" ]; then
|
||||||
|
installed_types+=("${download_dirs[j]}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Build the menu item
|
||||||
|
unset menu_option_text
|
||||||
|
if [ "${#download_dirs[@]}" -eq 2 ]; then
|
||||||
|
# We're only installing to one location
|
||||||
|
if [ -d "${download_dirs[1]}/$download_name" ]; then
|
||||||
|
menu_option_text="$download_name [installed]"
|
||||||
|
else
|
||||||
|
# The file is not installed
|
||||||
|
menu_option_text="$download_name"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
menu_options+=("$download_name")
|
# We're installing to multiple locations
|
||||||
|
if [ "${#installed_types[@]}" -gt 0 ]; then
|
||||||
|
# The file is already installed
|
||||||
|
menu_option_text="$download_name [installed:"
|
||||||
|
for (( j=0; j<"${#installed_types[@]}"; j++ )); do
|
||||||
|
# Add labels for each installed location
|
||||||
|
menu_option_text="$menu_option_text ${installed_types[j]}"
|
||||||
|
done
|
||||||
|
# Complete the menu text
|
||||||
|
menu_option_text="$menu_option_text]"
|
||||||
|
else
|
||||||
|
# The file is not installed
|
||||||
|
menu_option_text="$download_name"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Add the file names to the menu
|
||||||
|
menu_options+=("$menu_option_text")
|
||||||
menu_actions+=("download_install $i")
|
menu_actions+=("download_install $i")
|
||||||
|
|
||||||
# Increment the added items counter
|
# Increment the added items counter
|
||||||
@ -1327,7 +1442,7 @@ download_select_install() {
|
|||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
|
|
||||||
# Manage downloads
|
# Manage downloads. Called by a dedicated download type manage function, ie runner_manage() below
|
||||||
#
|
#
|
||||||
# This function expects the following variables to be set:
|
# This function expects the following variables to be set:
|
||||||
#
|
#
|
||||||
@ -1335,8 +1450,8 @@ download_select_install() {
|
|||||||
# of items to download. It should be pointed to the appropriate
|
# of items to download. It should be pointed to the appropriate
|
||||||
# array set at the top of the script using indirect expansion.
|
# array set at the top of the script using indirect expansion.
|
||||||
# See runner_sources at the top and runner_manage() below for examples.
|
# See runner_sources at the top and runner_manage() below for examples.
|
||||||
# - The string download_dir should contain the location the downloaded item
|
# - The array download_dirs should contain the locations the downloaded item
|
||||||
# will be installed to.
|
# will be installed to. Must be formatted in pairs of ("[type]" "[directory]")
|
||||||
# - The string "download_menu_heading" should contain the type of item
|
# - The string "download_menu_heading" should contain the type of item
|
||||||
# being downloaded. It will appear in the menu heading.
|
# being downloaded. It will appear in the menu heading.
|
||||||
# - The string "download_menu_description" should contain a description of
|
# - The string "download_menu_description" should contain a description of
|
||||||
@ -1346,22 +1461,12 @@ download_select_install() {
|
|||||||
# This function also expects one string argument containing the type of item to
|
# This function also expects one string argument containing the type of item to
|
||||||
# be downloaded. ie. runner or dxvk.
|
# be downloaded. ie. runner or dxvk.
|
||||||
#
|
#
|
||||||
# See runner_manage below for a configuration example.
|
# See runner_manage() below for a configuration example.
|
||||||
download_manage() {
|
download_manage() {
|
||||||
# This function expects a string to be passed as an argument
|
# This function expects a string to be passed as an argument
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
debug_print exit "Script error: The download_manage function expects a string argument. Aborting."
|
debug_print exit "Script error: The download_manage function expects a string argument. Aborting."
|
||||||
fi
|
fi
|
||||||
# Check if Lutris is installed
|
|
||||||
lutris_detect
|
|
||||||
if [ "$lutris_installed" = "false" ]; then
|
|
||||||
message warning "Lutris is required but does not appear to be installed."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [ ! -d "$download_dir" ]; then
|
|
||||||
message info "The following Lutris directory was not found. Unable to continue.\n\n$download_dir"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the type of item we're downloading from the function arguments
|
# Get the type of item we're downloading from the function arguments
|
||||||
download_type="$1"
|
download_type="$1"
|
||||||
@ -1381,7 +1486,7 @@ download_manage() {
|
|||||||
unset menu_actions
|
unset menu_actions
|
||||||
|
|
||||||
# Loop through the download_sources array and create a menu item
|
# Loop through the download_sources array and create a menu item
|
||||||
# for each one. Even numbered elements will contain the runner name
|
# for each one. Even numbered elements will contain the item name
|
||||||
for (( i=0; i<"${#download_sources[@]}"; i=i+2 )); do
|
for (( i=0; i<"${#download_sources[@]}"; i=i+2 )); do
|
||||||
# Set the options to be displayed in the menu
|
# Set the options to be displayed in the menu
|
||||||
menu_options+=("Install a $download_type from ${download_sources[i]}")
|
menu_options+=("Install a $download_type from ${download_sources[i]}")
|
||||||
@ -1416,7 +1521,27 @@ runner_manage() {
|
|||||||
# Use indirect expansion to point download_sources
|
# Use indirect expansion to point download_sources
|
||||||
# to the runner_sources array set at the top of the script
|
# to the runner_sources array set at the top of the script
|
||||||
declare -n download_sources=runner_sources
|
declare -n download_sources=runner_sources
|
||||||
download_dir="$runners_dir"
|
|
||||||
|
# Check if Lutris is installed and get relevant directories
|
||||||
|
get_lutris_dirs "runner"
|
||||||
|
if [ "$lutris_installed" = "false" ]; then
|
||||||
|
message warning "Lutris is required but does not appear to be installed."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Point download_dirs to the lutris_dirs array set by get_lutris_dirs
|
||||||
|
# Must be formatted in pairs of ("[type]" "[directory]")
|
||||||
|
declare -n download_dirs=lutris_dirs
|
||||||
|
# Verify the directories actually exist
|
||||||
|
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]}"
|
||||||
|
missing_dir="true"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$missing_dir" = "true" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure the text displayed in the menus
|
# Configure the text displayed in the menus
|
||||||
download_menu_heading="Lutris Runners"
|
download_menu_heading="Lutris Runners"
|
||||||
@ -1451,7 +1576,27 @@ dxvk_manage() {
|
|||||||
# Use indirect expansion to point download_sources
|
# Use indirect expansion to point download_sources
|
||||||
# to the dxvk_sources array set at the top of the script
|
# to the dxvk_sources array set at the top of the script
|
||||||
declare -n download_sources=dxvk_sources
|
declare -n download_sources=dxvk_sources
|
||||||
download_dir="$dxvk_dir"
|
|
||||||
|
# Check if Lutris is installed and get relevant directories
|
||||||
|
get_lutris_dirs "dxvk"
|
||||||
|
if [ "$lutris_installed" = "false" ]; then
|
||||||
|
message warning "Lutris is required but does not appear to be installed."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Point download_dirs to the lutris_dirs array set by get_lutris_dirs
|
||||||
|
# Must be formatted in pairs of ("[type]" "[directory]")
|
||||||
|
declare -n download_dirs=lutris_dirs
|
||||||
|
# Verify the directories actually exist
|
||||||
|
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]}"
|
||||||
|
missing_dir="true"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$missing_dir" = "true" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure the text displayed in the menus
|
# Configure the text displayed in the menus
|
||||||
download_menu_heading="Lutris DXVK Versions"
|
download_menu_heading="Lutris DXVK Versions"
|
||||||
|
Loading…
Reference in New Issue
Block a user