mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-13 19:30:34 +00:00
Compare commits
4 Commits
44bcbf8161
...
25b122e891
Author | SHA1 | Date | |
---|---|---|---|
|
25b122e891 | ||
|
a76c3d0a1a | ||
|
25a773602e | ||
|
d5d7f75dde |
@ -806,6 +806,22 @@ lutris_restart() {
|
||||
|
||||
#------------------------- begin download functions ----------------------------#
|
||||
|
||||
# Display post download message or instructions if needed
|
||||
# Expects the variables message_heading, post_download_msg1,
|
||||
# post_download_msg2, and downloaded_item_name
|
||||
post_download() {
|
||||
if [ "$trigger_post_download" = "true" ]; then
|
||||
message_heading="Download Complete"
|
||||
|
||||
if [ "$use_zenity" -eq 1 ]; then
|
||||
message_heading="<b>$message_heading</b>"
|
||||
post_download_msg2="<i>$post_download_msg2</i>"
|
||||
fi
|
||||
message info "$message_heading\n\n$post_download_msg1\n\n$post_download_msg2\n$downloaded_item_name"
|
||||
fi
|
||||
trigger_post_download="false"
|
||||
}
|
||||
|
||||
# Uninstall the selected item
|
||||
download_delete() {
|
||||
# This function expects an index number for the array
|
||||
@ -957,6 +973,7 @@ download_install() {
|
||||
for extracted_item in "$tmp_dir/$download_name"/*; do
|
||||
if [ -d "$extracted_item" ]; then
|
||||
num_dirs="$((num_dirs+1))"
|
||||
extracted_dir="$(basename "$extracted_item")"
|
||||
elif [ -f "$extracted_item" ]; then
|
||||
num_files="$((num_files+1))"
|
||||
fi
|
||||
@ -966,13 +983,9 @@ download_install() {
|
||||
if [ "$num_dirs" -eq 0 ] && [ "$num_files" -eq 0 ]; then
|
||||
# Sanity check
|
||||
message warning "The downloaded archive is empty. There is nothing to do."
|
||||
# Cleanup tmp download
|
||||
debug_print continue "Removing $tmp_dir/$download_file..."
|
||||
rm "$tmp_dir/$download_file"
|
||||
return 1
|
||||
elif [ "$num_dirs" -eq 1 ] && [ "$num_files" -eq 0 ]; then
|
||||
# If the archive contains only one directory, install that directory
|
||||
debug_print continue "Installing $download_type into $download_dir..."
|
||||
debug_print continue "Installing $download_type into $download_dir/$extracted_dir..."
|
||||
if [ "$use_zenity" -eq 1 ]; then
|
||||
# Use Zenity progress bar
|
||||
mkdir -p "$download_dir" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir" | \
|
||||
@ -980,7 +993,15 @@ download_install() {
|
||||
else
|
||||
mkdir -p "$download_dir" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"
|
||||
fi
|
||||
|
||||
# We need to restart Lutris for the download to be detected
|
||||
lutris_needs_restart="true"
|
||||
|
||||
# Store the final name of the downloaded directory
|
||||
downloaded_item_name="$extracted_dir"
|
||||
|
||||
# Trigger the post_download() function
|
||||
trigger_post_download="true"
|
||||
elif [ "$num_dirs" -gt 1 ] || [ "$num_files" -gt 0 ]; then
|
||||
# If the archive contains more than one directory or
|
||||
# one or more files, we must create a subdirectory
|
||||
@ -992,7 +1013,15 @@ download_install() {
|
||||
else
|
||||
mkdir -p "$download_dir/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"/"$download_name"
|
||||
fi
|
||||
|
||||
# We need to restart Lutris for the download to be detected
|
||||
lutris_needs_restart="true"
|
||||
|
||||
# Store the final name of the downloaded directory
|
||||
downloaded_item_name="$download_name"
|
||||
|
||||
# Trigger the post_download() function
|
||||
trigger_post_download="true"
|
||||
else
|
||||
# Some unexpected combination of directories and files
|
||||
debug_print exit "Script error: Unexpected archive contents in download_install function. Aborting"
|
||||
@ -1000,8 +1029,11 @@ download_install() {
|
||||
fi
|
||||
|
||||
# Cleanup tmp download
|
||||
debug_print continue "Removing $tmp_dir/$download_file..."
|
||||
debug_print continue "Cleaning up $tmp_dir/$download_file..."
|
||||
rm "$tmp_dir/$download_file"
|
||||
|
||||
# Display any post-download messages or instructions
|
||||
post_download
|
||||
}
|
||||
|
||||
# List available items for download
|
||||
@ -1193,6 +1225,10 @@ download_manage() {
|
||||
|
||||
# Configure the download_manage function for runners
|
||||
runner_manage() {
|
||||
# Set some defaults
|
||||
lutris_needs_restart="false"
|
||||
trigger_post_download="false"
|
||||
|
||||
# Use indirect expansion to point download_sources
|
||||
# to the runner_sources array set at the top of the script
|
||||
declare -n download_sources=runner_sources
|
||||
@ -1203,6 +1239,15 @@ runner_manage() {
|
||||
download_menu_description="The runners listed below are wine builds created for Star Citizen"
|
||||
download_menu_height="140"
|
||||
|
||||
# Set the post download instructions
|
||||
# Format:
|
||||
# A header is automatically displayed that reads: Download Complete
|
||||
# msg1 is displayed below the header
|
||||
# msg2 is displayed below that in italics when zenity is in use
|
||||
# Lastly, the downloaded directory name is automatically displayed
|
||||
post_download_msg1="Select the runner in Lutris from the dropdown menu"
|
||||
post_download_msg2="Configure->Runner Options->Wine version"
|
||||
|
||||
# Call the download_manage function with the above configuration
|
||||
# The argument passed to the function is used for special handling
|
||||
# and displayed in the menus and dialogs.
|
||||
@ -1211,6 +1256,10 @@ runner_manage() {
|
||||
|
||||
# Configure the download_manage function for dxvks
|
||||
dxvk_manage() {
|
||||
# Set some defaults
|
||||
lutris_needs_restart="false"
|
||||
trigger_post_download="false"
|
||||
|
||||
# Use indirect expansion to point download_sources
|
||||
# to the dxvk_sources array set at the top of the script
|
||||
declare -n download_sources=dxvk_sources
|
||||
@ -1221,6 +1270,15 @@ dxvk_manage() {
|
||||
download_menu_description="The DXVK versions below may help improve game performance"
|
||||
download_menu_height="140"
|
||||
|
||||
# Set the post download instructions
|
||||
# Format:
|
||||
# A header is automatically displayed that reads: Download Complete
|
||||
# msg1 is displayed below the header
|
||||
# msg2 is displayed below that in italics when zenity is in use
|
||||
# Lastly, the downloaded directory name is automatically displayed
|
||||
post_download_msg1="Type the DXVK folder name in your Lutris settings"
|
||||
post_download_msg2="Configure->Runner Options->DXVK version"
|
||||
|
||||
# Call the download_manage function with the above configuration
|
||||
# The argument passed to the function is used for special handling
|
||||
# and displayed in the menus and dialogs.
|
||||
@ -1435,9 +1493,8 @@ if [ -x "$(command -v zenity)" ]; then
|
||||
use_zenity=1
|
||||
fi
|
||||
|
||||
# Set some defaults
|
||||
# Set defaults
|
||||
live_or_ptu="$live_dir"
|
||||
lutris_needs_restart="false"
|
||||
|
||||
# Check if a newer verison of the script is available
|
||||
latest_version="$(get_latest_release "$repo")"
|
||||
|
Loading…
x
Reference in New Issue
Block a user