Silent install, terminate wine afterwards to avoid ghost processes

This commit is contained in:
the-sane 2024-09-19 21:18:25 -04:00
parent 2af88d978e
commit 0ca4c76ef8

View File

@ -2545,7 +2545,6 @@ install_game_wine() {
if [ ! -f "$tmp_dir/$rsi_installer" ]; then if [ ! -f "$tmp_dir/$rsi_installer" ]; 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; the installer could not be downloaded!" message error "Something went wrong; the installer could not be downloaded!"
debug_print continue "Download failed! File not found: $tmp_dir/$rsi_installer"
return 1 return 1
fi fi
@ -2553,12 +2552,15 @@ install_game_wine() {
tmp_install_log="$(mktemp --suffix=".log" -t "lughelper-install-XXX")" tmp_install_log="$(mktemp --suffix=".log" -t "lughelper-install-XXX")"
# Run the installer # Run the installer
export WINEPREFIX="$install_dir"
debug_print continue "Preparing the wine prefix..." debug_print continue "Preparing the wine prefix..."
WINEPREFIX="$install_dir" winecfg -v win11 >"$tmp_install_log" 2>&1 && winecfg -v win11 >"$tmp_install_log" 2>&1 &&
debug_print continue "Installing dxvk and powershell..."
WINEPREFIX="$install_dir" winetricks dxvk powershell >>"$tmp_install_log" 2>&1 debug_print continue "Installing dxvk and powershell, please wait..."
debug_print continue "Launching the RSI Installer..." winetricks dxvk powershell >>"$tmp_install_log" 2>&1
WINEPREFIX="$install_dir" wine "$tmp_dir/$rsi_installer" >>"$tmp_install_log" 2>&1
debug_print continue "Installing the launcher, please wait..."
wine "$tmp_dir/$rsi_installer" /S >>"$tmp_install_log" 2>&1
if [ "$?" -eq 1 ]; then if [ "$?" -eq 1 ]; then
# User cancelled or there was an error # User cancelled or there was an error
@ -2566,9 +2568,14 @@ install_game_wine() {
debug_print continue "Deleting $install_dir..." debug_print continue "Deleting $install_dir..."
rm -r --interactive=never "$install_dir" rm -r --interactive=never "$install_dir"
fi fi
wineserver -k
return 0 return 0
fi 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
# Save the install location to the Helper's config files # Save the install location to the Helper's config files
rm --interactive=never "${conf_dir:?}/$conf_subdir/"{winedir,gamedir}.conf 2>/dev/null rm --interactive=never "${conf_dir:?}/$conf_subdir/"{winedir,gamedir}.conf 2>/dev/null
wine_prefix="$install_dir" wine_prefix="$install_dir"
@ -2577,6 +2584,12 @@ install_game_wine() {
fi fi
getdirs getdirs
# Verify that we have an installed game path
if [ -z "$game_path" ]; then
message error "Something went wrong during installation. Unable to locate the expected game path. Aborting."
return 1
fi
# Copy game launch script to the wine prefix root directory # Copy game launch script to the wine prefix root directory
debug_print continue "Copying game launch script to ${install_dir}..." debug_print continue "Copying game launch script to ${install_dir}..."
cp "$launch_script" "$install_dir" cp "$launch_script" "$install_dir"