mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 02:04:19 +00:00
Download a default wine runner if system wine does not meet reqs
This commit is contained in:
parent
86f3b3b1f6
commit
ca39caf92b
447
lug-helper.sh
447
lug-helper.sh
@ -210,6 +210,11 @@ runner_sources=(
|
|||||||
"RawFox" "https://api.github.com/repos/starcitizen-lug/raw-wine/releases"
|
"RawFox" "https://api.github.com/repos/starcitizen-lug/raw-wine/releases"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Set the default runner to install when the system wine doesn't meet requirements
|
||||||
|
# default_runner_source corresponds to an even number index in runner_sources above
|
||||||
|
default_runner="wine-9.20-amd64.tar.xz"
|
||||||
|
default_runner_source=0
|
||||||
|
|
||||||
######## DXVK ##############################################################
|
######## DXVK ##############################################################
|
||||||
|
|
||||||
# Lutris native dxvk directory
|
# Lutris native dxvk directory
|
||||||
@ -977,10 +982,18 @@ lutris_detect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check the system Wine version
|
# Check the system Wine version
|
||||||
|
# Tells the preflight check whether or not wine is installed
|
||||||
|
# Additionally sets system_wine_ok if system wine meets the minimum version requirement
|
||||||
wine_check() {
|
wine_check() {
|
||||||
|
# Initialize variable
|
||||||
|
system_wine_ok="false"
|
||||||
|
|
||||||
|
# Is wine installed?
|
||||||
if [ ! -x "$(command -v wine)" ]; then
|
if [ ! -x "$(command -v wine)" ]; then
|
||||||
preflight_fail+=("Wine does not appear to be installed.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
|
preflight_fail+=("Wine does not appear to be installed.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
|
||||||
return 1
|
return 1
|
||||||
|
else
|
||||||
|
preflight_pass+=("Wine is installed on your system.")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the current wine version
|
# Get the current wine version
|
||||||
@ -988,12 +1001,17 @@ wine_check() {
|
|||||||
|
|
||||||
# Check it against the required version
|
# Check it against the required version
|
||||||
if [ -z "$wine_current" ]; then
|
if [ -z "$wine_current" ]; then
|
||||||
preflight_fail+=("Unable to detect Wine version info.\nVersion $wine_required or newer is required.")
|
system_wine_ok="false"
|
||||||
elif [ "$wine_required" != "$wine_current" ] &&
|
elif [ "$wine_required" != "$wine_current" ] &&
|
||||||
[ "$wine_current" = "$(printf "%s\n%s" "$wine_current" "$wine_required" | sort -V | head -n1)" ]; then
|
[ "$wine_current" = "$(printf "%s\n%s" "$wine_current" "$wine_required" | sort -V | head -n1)" ]; then
|
||||||
preflight_fail+=("Wine is out of date.\nVersion $wine_required or newer is required.")
|
system_wine_ok="false"
|
||||||
else
|
else
|
||||||
preflight_pass+=("Wine is installed and sufficiently up to date.")
|
system_wine_ok="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for wow64 wines
|
||||||
|
if [ ! -x "$(command -v wine-preloader)" ] || [ -L "$(command -v wine64-preloader)" ]; then
|
||||||
|
system_wine_ok="false"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,8 +1428,7 @@ dxvk_manage_lutris() {
|
|||||||
# - download_type (string)
|
# - download_type (string)
|
||||||
# - download_dirs (array)
|
# - download_dirs (array)
|
||||||
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
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
debug_print exit "Script error: The download_select_install function expects a numerical argument. Aborting."
|
debug_print exit "Script error: The download_select_install function expects a numerical argument. Aborting."
|
||||||
fi
|
fi
|
||||||
@ -1841,6 +1858,8 @@ download_install() {
|
|||||||
debug_print continue "Cleaning up $tmp_dir/$download_filename..."
|
debug_print continue "Cleaning up $tmp_dir/$download_filename..."
|
||||||
rm --interactive=never "${tmp_dir:?}/$download_filename"
|
rm --interactive=never "${tmp_dir:?}/$download_filename"
|
||||||
rm -r "${tmp_dir:?}/$download_basename"
|
rm -r "${tmp_dir:?}/$download_basename"
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# List installed items for deletion. Called by download_manage()
|
# List installed items for deletion. Called by download_manage()
|
||||||
@ -2621,7 +2640,7 @@ install_game_wine() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the preflight check
|
# Call the preflight check and confirm the user is ready to proceed
|
||||||
preflight_check "wine"
|
preflight_check "wine"
|
||||||
if [ "$?" -eq 1 ]; then
|
if [ "$?" -eq 1 ]; then
|
||||||
# There were errors
|
# There were errors
|
||||||
@ -2630,219 +2649,277 @@ install_game_wine() {
|
|||||||
# No errors
|
# No errors
|
||||||
install_question="Before proceeding, please refer to our Quick Start Guide:\n$lug_wiki\n\nAll Preflight Checks have passed\nAre you ready to continue?"
|
install_question="Before proceeding, please refer to our Quick Start Guide:\n$lug_wiki\n\nAll Preflight Checks have passed\nAre you ready to continue?"
|
||||||
fi
|
fi
|
||||||
|
if ! message question "$install_question"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if message question "$install_question"; then
|
# Get the install path from the user
|
||||||
if message question "Would you like to use the default install path?\n\n$HOME/Games/star-citizen"; then
|
if message question "Would you like to use the default install path?\n\n$HOME/Games/star-citizen"; then
|
||||||
# Set the default install path
|
# Set the default install path
|
||||||
install_dir="$HOME/Games/star-citizen"
|
install_dir="$HOME/Games/star-citizen"
|
||||||
else
|
else
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
if message options "Create my own prefix dir" "Continue" "After clicking Continue, select your Star Citizen install location.\nA new subdirectory named 'star-citizen' will be created in the selected location. This will be your wine prefix.\n\nIf you know what you are doing and want to create your own prefix directory, choose \"Create my own prefix dir\""; then
|
if message options "Create my own prefix dir" "Continue" "After clicking Continue, select your Star Citizen install location.\nA new subdirectory named 'star-citizen' will be created in the selected location. This will be your wine prefix.\n\nIf you know what you are doing and want to create your own prefix directory, choose \"Create my own prefix dir\""; then
|
||||||
# Default, create the star-citizen directory
|
# Default, create the star-citizen directory
|
||||||
install_prefix="star-citizen"
|
install_prefix="star-citizen"
|
||||||
else
|
else
|
||||||
# User will create their own prefix directory
|
# User will create their own prefix directory
|
||||||
install_prefix=""
|
install_prefix=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the install path from the user
|
||||||
|
while true; do
|
||||||
|
install_dir="$(zenity --file-selection --directory --title="Choose your Star Citizen install directory" --filename="$HOME/" 2>/dev/null)"
|
||||||
|
|
||||||
|
if [ "$?" -eq -1 ]; then
|
||||||
|
message error "An unexpected error has occurred. The Helper is unable to proceed."
|
||||||
|
return 1
|
||||||
|
elif [ -z "$install_dir" ]; then
|
||||||
|
# User clicked cancel or something else went wrong
|
||||||
|
message warning "Installation cancelled."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the install path from the user
|
# Add the wine prefix subdirectory to the install path
|
||||||
while true; do
|
if [ -n "$install_prefix" ]; then
|
||||||
install_dir="$(zenity --file-selection --directory --title="Choose your Star Citizen install directory" --filename="$HOME/" 2>/dev/null)"
|
install_dir="$install_dir/$install_prefix"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$?" -eq -1 ]; then
|
# Sanity check the chosen directory a bit to catch some possible mistakes
|
||||||
message error "An unexpected error has occurred. The Helper is unable to proceed."
|
if [ "$install_dir" = "/" ] || [ "$install_dir" = "$HOME" ] || [ "$install_dir" = "$HOME/Games" ]; then
|
||||||
return 1
|
if message question "Something seems off! This directory will become your wine prefix. Are you really sure this is what you want?\n\n$install_dir"; then
|
||||||
elif [ -z "$install_dir" ]; then
|
|
||||||
# User clicked cancel or something else went wrong
|
|
||||||
message warning "Installation cancelled."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add the wine prefix subdirectory to the install path
|
|
||||||
if [ -n "$install_prefix" ]; then
|
|
||||||
install_dir="$install_dir/$install_prefix"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Sanity check the chosen directory a bit to catch some possible mistakes
|
|
||||||
if [ "$install_dir" = "/" ] || [ "$install_dir" = "$HOME" ] || [ "$install_dir" = "$HOME/Games" ]; then
|
|
||||||
if message question "Something seems off! This directory will become your wine prefix. Are you really sure this is what you want?\n\n$install_dir"; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# All good, break out of the loop and continue
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
else
|
# All good, break out of the loop and continue
|
||||||
# No Zenity, use terminal-based menus
|
break
|
||||||
clear
|
fi
|
||||||
# Get the install path from the user
|
done
|
||||||
printf "Enter the desired Star Citizen install path (case sensitive)\nie. /home/USER/Games/star-citizen\n\n"
|
else
|
||||||
while read -rp "Install path: " install_dir; do
|
# No Zenity, use terminal-based menus
|
||||||
if [ -z "$install_dir" ]; then
|
clear
|
||||||
printf "Invalid directory. Please try again.\n\n"
|
# Get the install path from the user
|
||||||
elif [ ! -d "$install_dir" ]; then
|
printf "Enter the desired Star Citizen install path (case sensitive)\nie. /home/USER/Games/star-citizen\n\n"
|
||||||
if message question "That directory does not exist.\nWould you like it to be created for you?\n"; then
|
while read -rp "Install path: " install_dir; do
|
||||||
break
|
if [ -z "$install_dir" ]; then
|
||||||
fi
|
printf "Invalid directory. Please try again.\n\n"
|
||||||
else
|
elif [ ! -d "$install_dir" ]; then
|
||||||
|
if message question "That directory does not exist.\nWould you like it to be created for you?\n"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
fi
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the game path
|
# Create the game path
|
||||||
mkdir -p "$install_dir"
|
mkdir -p "$install_dir"
|
||||||
|
|
||||||
# Download RSI installer to tmp
|
# If we can't use the system wine, we'll need to have the user select a custom wine runner to use
|
||||||
download_file "$rsi_installer_url" "$rsi_installer" "installer"
|
wine_bin="wine"
|
||||||
|
if [ "$system_wine_ok" = "true" ]; then
|
||||||
|
debug_print continue "Your system Wine does not meet the minimum requirements for Star Citizen!"
|
||||||
|
debug_print continue "A custom wine runner will be automatically downloaded and used."
|
||||||
|
|
||||||
# Sanity check
|
download_dirs=("wine" "$install_dir/runners")
|
||||||
if [ ! -f "$tmp_dir/$rsi_installer" ]; then
|
|
||||||
# Something went wrong with the download and the file doesn't exist
|
# Install the default wine runner into the prefix
|
||||||
message error "Something went wrong; the installer could not be downloaded!"
|
download_wine
|
||||||
|
# Make sure the wine download worked
|
||||||
|
if [ "$?" -eq 1 ]; then
|
||||||
|
message error "Something went wrong while installing ${default_runner}!\nGame installation cannot proceed."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download winetricks
|
wine_bin="$install_dir/runners/$downloaded_item_name/bin/wine"
|
||||||
download_winetricks
|
fi
|
||||||
|
|
||||||
# Abort if the winetricks download failed
|
# Download winetricks
|
||||||
if [ "$?" -eq 1 ]; then
|
download_winetricks
|
||||||
message error "Unable to install Star Citizen without winetricks. Aborting."
|
# Abort if the winetricks download failed
|
||||||
return 1
|
if [ "$?" -eq 1 ]; then
|
||||||
|
message error "Unable to install Star Citizen without winetricks. Aborting."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download RSI installer to tmp
|
||||||
|
download_file "$rsi_installer_url" "$rsi_installer" "installer"
|
||||||
|
# Sanity check
|
||||||
|
if [ ! -f "$tmp_dir/$rsi_installer" ]; then
|
||||||
|
# Something went wrong with the download and the file doesn't exist
|
||||||
|
message error "Something went wrong; the installer could not be downloaded!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a temporary log file
|
||||||
|
tmp_install_log="$(mktemp --suffix=".log" -t "lughelper-install-XXX")"
|
||||||
|
debug_print continue "Installation log file created at $tmp_install_log"
|
||||||
|
|
||||||
|
# Create the new prefix and install powershell
|
||||||
|
export WINEPREFIX="$install_dir"
|
||||||
|
debug_print continue "Preparing the wine prefix. Please wait; this will take a moment..."
|
||||||
|
"$winetricks_bin" -q arial tahoma dxvk powershell win11 >"$tmp_install_log" 2>&1
|
||||||
|
|
||||||
|
if [ "$?" -eq 1 ]; then
|
||||||
|
if message question "Wine prefix creation failed. Aborting installation.\nThe install log was written to\n$tmp_install_log\n\nDo you want to delete\n${install_dir}?"; then
|
||||||
|
debug_print continue "Deleting $install_dir..."
|
||||||
|
rm -r --interactive=never "$install_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a temporary log file
|
|
||||||
tmp_install_log="$(mktemp --suffix=".log" -t "lughelper-install-XXX")"
|
|
||||||
|
|
||||||
debug_print continue "Installation log file created at $tmp_install_log"
|
|
||||||
|
|
||||||
# Create the new prefix and install powershell
|
|
||||||
export WINEPREFIX="$install_dir"
|
|
||||||
debug_print continue "Preparing the wine prefix. Please wait; this will take a moment..."
|
|
||||||
"$winetricks_bin" -q arial tahoma dxvk powershell win11 >"$tmp_install_log" 2>&1
|
|
||||||
|
|
||||||
if [ "$?" -eq 1 ]; then
|
|
||||||
if message question "Wine prefix creation failed. Aborting installation.\nThe install log was written to\n$tmp_install_log\n\nDo you want to delete\n${install_dir}?"; then
|
|
||||||
debug_print continue "Deleting $install_dir..."
|
|
||||||
rm -r --interactive=never "$install_dir"
|
|
||||||
fi
|
|
||||||
wineserver -k
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add registry key that prevents wine from creating unnecessary file type associations
|
|
||||||
wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N /f >>"$tmp_install_log" 2>&1
|
|
||||||
|
|
||||||
# Run the installer
|
|
||||||
debug_print continue "Installing the launcher. Please wait; this will take a moment..."
|
|
||||||
wine "$tmp_dir/$rsi_installer" /S >>"$tmp_install_log" 2>&1
|
|
||||||
|
|
||||||
if [ "$?" -eq 1 ]; then
|
|
||||||
# User cancelled or there was an error
|
|
||||||
if message question "Installation aborted. The install log was written to\n$tmp_install_log\n\nDo you want to delete\n${install_dir}?"; then
|
|
||||||
debug_print continue "Deleting $install_dir..."
|
|
||||||
rm -r --interactive=never "$install_dir"
|
|
||||||
fi
|
|
||||||
wineserver -k
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Kill the wine process after installation
|
|
||||||
# To prevent unexpected lingering background wine processes, it should be launched by the user attached to a terminal
|
|
||||||
wineserver -k
|
wineserver -k
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Save the install location to the Helper's config files
|
# Add registry key that prevents wine from creating unnecessary file type associations
|
||||||
reset_helper "switchprefix"
|
"$wine_bin" reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N /f >>"$tmp_install_log" 2>&1
|
||||||
wine_prefix="$install_dir"
|
|
||||||
if [ -d "$wine_prefix/$default_install_path" ]; then
|
# Run the installer
|
||||||
game_path="$wine_prefix/$default_install_path/$sc_base_dir"
|
debug_print continue "Installing the launcher. Please wait; this will take a moment..."
|
||||||
|
"$wine_bin" "$tmp_dir/$rsi_installer" /S >>"$tmp_install_log" 2>&1
|
||||||
|
|
||||||
|
if [ "$?" -eq 1 ]; then
|
||||||
|
# User cancelled or there was an error
|
||||||
|
if message question "Installation aborted. The install log was written to\n$tmp_install_log\n\nDo you want to delete\n${install_dir}?"; then
|
||||||
|
debug_print continue "Deleting $install_dir..."
|
||||||
|
rm -r --interactive=never "$install_dir"
|
||||||
fi
|
fi
|
||||||
getdirs
|
wineserver -k
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify that we have an installed game path
|
# Kill the wine process after installation
|
||||||
if [ -z "$game_path" ]; then
|
# To prevent unexpected lingering background wine processes, it should be launched by the user attached to a terminal
|
||||||
message error "Something went wrong during installation. Unable to locate the expected game path. Aborting."
|
wineserver -k
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy game launch script to the wine prefix root directory
|
# Save the install location to the Helper's config files
|
||||||
debug_print continue "Copying game launch script to ${install_dir}..."
|
reset_helper "switchprefix"
|
||||||
cp "$wine_launch_script" "$install_dir"
|
wine_prefix="$install_dir"
|
||||||
installed_launch_script="$install_dir/$wine_launch_script_name"
|
if [ -d "$wine_prefix/$default_install_path" ]; then
|
||||||
|
game_path="$wine_prefix/$default_install_path/$sc_base_dir"
|
||||||
|
fi
|
||||||
|
getdirs
|
||||||
|
|
||||||
# Update WINEPREFIX in game launch script
|
# Verify that we have an installed game path
|
||||||
sed -i "s|^export WINEPREFIX.*|export WINEPREFIX=\"$install_dir\"|" "$installed_launch_script"
|
if [ -z "$game_path" ]; then
|
||||||
|
message error "Something went wrong during installation. Unable to locate the expected game path. Aborting."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Modify the .desktop files installed by wine to exec the game launch script
|
# Copy game launch script to the wine prefix root directory
|
||||||
debug_print continue "Updating .desktop files installed by wine..."
|
debug_print continue "Copying game launch script to ${install_dir}..."
|
||||||
|
cp "$wine_launch_script" "$install_dir"
|
||||||
|
installed_launch_script="$install_dir/$wine_launch_script_name"
|
||||||
|
|
||||||
# Copy the bundled RSI Launcher icon to the .local icons directory
|
# Update WINEPREFIX in game launch script
|
||||||
if [ -f "$rsi_icon" ]; then
|
sed -i "s|^export WINEPREFIX.*|export WINEPREFIX=\"$install_dir\"|" "$installed_launch_script"
|
||||||
mkdir -p "$HOME/.local/share/icons/hicolor/256x256/apps" &&
|
|
||||||
cp "$rsi_icon" "$HOME/.local/share/icons/hicolor/256x256/apps"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Modify $HOME/Desktop/RSI Launcher.desktop
|
# Update Wine binary in game launch script
|
||||||
home_desktop_file="${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
if [ "$wine_bin" != "wine" ]; then
|
||||||
if [ -f "$home_desktop_file" ]; then
|
post_download_sed_string="wine_exec="
|
||||||
# Replace the exec line with our launch script
|
sed -i "s|^${post_download_sed_string}.*|${post_download_sed_string}\"${wine_bin}\"|" "$installed_launch_script"
|
||||||
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$home_desktop_file"
|
fi
|
||||||
# Quote exec line
|
|
||||||
sed -i '/^Exec=/s/=/="/' "$home_desktop_file"
|
|
||||||
sed -i '/^Exec=/s/$/"/' "$home_desktop_file"
|
|
||||||
# Escape spaces in path line
|
|
||||||
sed -i '/^Path=/s/ /\\\s/g' "$home_desktop_file"
|
|
||||||
# Replace icon
|
|
||||||
sed -i "s|^Icon=.*|Icon=$rsi_icon_name|" "$home_desktop_file"
|
|
||||||
# Make it start in a terminal
|
|
||||||
echo "Terminal=true" >> "$home_desktop_file"
|
|
||||||
debug_print continue "Updated $home_desktop_file"
|
|
||||||
else
|
|
||||||
debug_print continue "Unable to find $home_desktop_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Modify $HOME/.local/share/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop
|
# Modify the .desktop files installed by wine to exec the game launch script
|
||||||
localshare_desktop_file="$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
debug_print continue "Updating .desktop files installed by wine..."
|
||||||
if [ -f "$localshare_desktop_file" ]; then
|
|
||||||
# Replace the exec line with our launch script
|
|
||||||
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$localshare_desktop_file"
|
|
||||||
# Quote exec line
|
|
||||||
sed -i '/^Exec=/s/=/="/' "$localshare_desktop_file"
|
|
||||||
sed -i '/^Exec=/s/$/"/' "$localshare_desktop_file"
|
|
||||||
# Escape spaces in path line
|
|
||||||
sed -i '/^Path=/s/ /\\\s/g' "$localshare_desktop_file"
|
|
||||||
# Replace icon
|
|
||||||
sed -i "s|^Icon=.*|Icon=$rsi_icon_name|" "$localshare_desktop_file"
|
|
||||||
# Make it start in a terminal
|
|
||||||
echo "Terminal=true" >> "$localshare_desktop_file"
|
|
||||||
debug_print continue "Updated $localshare_desktop_file"
|
|
||||||
else
|
|
||||||
debug_print continue "Unable to find $localshare_desktop_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update the .desktop file database if the command is available
|
# Copy the bundled RSI Launcher icon to the .local icons directory
|
||||||
if [ -x "$(command -v update-desktop-database)" ]; then
|
if [ -f "$rsi_icon" ]; then
|
||||||
debug_print continue "Running update-desktop-database..."
|
mkdir -p "$HOME/.local/share/icons/hicolor/256x256/apps" &&
|
||||||
update-desktop-database "$HOME/.local/share/applications"
|
cp "$rsi_icon" "$HOME/.local/share/icons/hicolor/256x256/apps"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
message info "Installation has finished. The install log was written to $tmp_install_log\n\nTo start the RSI Launcher, run the following launch script in a terminal\nEdit the environment variables in the script as needed:\n $installed_launch_script\n\nYou may also start the RSI Launcher using the following .desktop files:\n $home_desktop_file\n $localshare_desktop_file"
|
# Modify $HOME/Desktop/RSI Launcher.desktop
|
||||||
fi
|
home_desktop_file="${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
|
if [ -f "$home_desktop_file" ]; then
|
||||||
|
# Replace the exec line with our launch script
|
||||||
|
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$home_desktop_file"
|
||||||
|
# Quote exec line
|
||||||
|
sed -i '/^Exec=/s/=/="/' "$home_desktop_file"
|
||||||
|
sed -i '/^Exec=/s/$/"/' "$home_desktop_file"
|
||||||
|
# Escape spaces in path line
|
||||||
|
sed -i '/^Path=/s/ /\\\s/g' "$home_desktop_file"
|
||||||
|
# Replace icon
|
||||||
|
sed -i "s|^Icon=.*|Icon=$rsi_icon_name|" "$home_desktop_file"
|
||||||
|
# Make it start in a terminal
|
||||||
|
echo "Terminal=true" >> "$home_desktop_file"
|
||||||
|
debug_print continue "Updated $home_desktop_file"
|
||||||
|
else
|
||||||
|
debug_print continue "Unable to find $home_desktop_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Modify $HOME/.local/share/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop
|
||||||
|
localshare_desktop_file="$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
|
if [ -f "$localshare_desktop_file" ]; then
|
||||||
|
# Replace the exec line with our launch script
|
||||||
|
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$localshare_desktop_file"
|
||||||
|
# Quote exec line
|
||||||
|
sed -i '/^Exec=/s/=/="/' "$localshare_desktop_file"
|
||||||
|
sed -i '/^Exec=/s/$/"/' "$localshare_desktop_file"
|
||||||
|
# Escape spaces in path line
|
||||||
|
sed -i '/^Path=/s/ /\\\s/g' "$localshare_desktop_file"
|
||||||
|
# Replace icon
|
||||||
|
sed -i "s|^Icon=.*|Icon=$rsi_icon_name|" "$localshare_desktop_file"
|
||||||
|
# Make it start in a terminal
|
||||||
|
echo "Terminal=true" >> "$localshare_desktop_file"
|
||||||
|
debug_print continue "Updated $localshare_desktop_file"
|
||||||
|
else
|
||||||
|
debug_print continue "Unable to find $localshare_desktop_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update the .desktop file database if the command is available
|
||||||
|
if [ -x "$(command -v update-desktop-database)" ]; then
|
||||||
|
debug_print continue "Running update-desktop-database..."
|
||||||
|
update-desktop-database "$HOME/.local/share/applications"
|
||||||
|
fi
|
||||||
|
|
||||||
|
message info "Installation has finished. The install log was written to $tmp_install_log\n\nTo start the RSI Launcher, run the following launch script in a terminal\nEdit the environment variables in the script as needed:\n $installed_launch_script\n\nYou may also start the RSI Launcher using the following .desktop files:\n $home_desktop_file\n $localshare_desktop_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download a default wine runner for use by the non-lutris installer
|
||||||
|
# Expects download_dirs to be set before calling
|
||||||
|
download_wine() {
|
||||||
|
if [ "${#download_dirs[@]}" -eq 0 ]; then
|
||||||
|
debug_print exit "Script error: The array 'download_dirs' was not set before calling the download_wine function. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set up variables needed for the download functions, quick and dirty
|
||||||
|
# For more details, see their usage in the download_select_install and download_install functions
|
||||||
|
declare -n download_sources=runner_sources
|
||||||
|
download_type="runner"
|
||||||
|
download_versions=("$default_runner")
|
||||||
|
contributor_name="${download_sources[$default_runner_source]}"
|
||||||
|
contributor_url="${download_sources[$default_runner_source+1]}"
|
||||||
|
case "$contributor_url" in
|
||||||
|
https://api.github.com/*)
|
||||||
|
download_url_type="github"
|
||||||
|
;;
|
||||||
|
https://gitlab.com/api/v4/projects/*)
|
||||||
|
download_url_type="gitlab"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug_print exit "Script error: Unknown api/url format in ${download_type}_sources array. Aborting."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Call the download_install function with the above options to install the default wine runner
|
||||||
|
download_install 0
|
||||||
|
|
||||||
|
if [ "$?" -eq 1 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download winetricks to a temporary file
|
# Download winetricks to a temporary file
|
||||||
download_winetricks() {
|
download_winetricks() {
|
||||||
download_file "$winetricks_url" "winetricks" "winetricks"
|
download_file "$winetricks_url" "winetricks" "winetricks"
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -f "$tmp_dir/winetricks" ]; then
|
if [ ! -f "$tmp_dir/winetricks" ]; then
|
||||||
# Something went wrong with the download and the file doesn't exist
|
# Something went wrong with the download and the file doesn't exist
|
||||||
message error "Something went wrong; winetricks could not be downloaded!"
|
message error "Something went wrong; winetricks could not be downloaded!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save the path to the downloaded binary
|
# Save the path to the downloaded binary
|
||||||
winetricks_bin="$tmp_dir/winetricks"
|
winetricks_bin="$tmp_dir/winetricks"
|
||||||
|
Loading…
Reference in New Issue
Block a user