fixed battlenet/temp solution

This commit is contained in:
Roy 2024-05-08 14:13:52 -07:00 committed by GitHub
parent d605ad0f78
commit 27d954e4f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1270,24 +1270,6 @@ if [[ $options == *"Battle.net"* ]]; then
# Run the BATTLE file using Proton with the /passive option
echo "Running BATTLE file using Proton with the /passive option"
"$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net"
max_attempts=20
attempt=0
while true; do
if pgrep -f "Battle.net.exe" || pgrep -f "BlizzardError.exe" > /dev/null; then
pkill -f "Battle.net.exe" || pkill -f "BlizzardError.exe"
break
fi
sleep 1
((attempt++))
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Timeout: Battle.net process did not terminate."
break
fi
done
wait
# Run the BATTLE file using Proton with the /passive option
echo "Running BATTLE file using Proton with the /passive option"
"$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net"
# Wait for the process to finish or timeout after a certain number of attempts
max_attempts=20
@ -1873,7 +1855,64 @@ if [[ "$options" == *"VK Play"* ]]; then
fi
##temp fix for battlenet
wait
echo "70"
echo "# Downloading & Installing Battle.net...please wait..."
# Check if user selected Battle.net
if [[ $options == *"Battle.net"* ]]; then
# User selected Battle.net
echo "User selected Battle.net"
# Set the appid for the Battlenet Launcher
if [ "$use_separate_appids" = true ]; then
appid=Battle.netLauncher
else
appid=NonSteamLaunchers
fi
# Create app id folder in compatdata folder if it doesn't exist
if [ ! -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/$appid" ]; then
mkdir -p "${logged_in_home}/.local/share/Steam/steamapps/compatdata/$appid"
fi
# Change working directory to Proton's
cd "$proton_dir"
# Set the STEAM_COMPAT_CLIENT_INSTALL_PATH environment variable
export STEAM_COMPAT_CLIENT_INSTALL_PATH="${logged_in_home}/.local/share/Steam"
# Set the STEAM_COMPAT_DATA_PATH environment variable for Epic Games Launcher
export STEAM_COMPAT_DATA_PATH="${logged_in_home}/.local/share/Steam/steamapps/compatdata/${appid}"
# Download BATTLE file if not already present
if [ ! -f "$battle_file" ]; then
echo "Downloading BATTLE file"
wget "$battle_url" -O "$battle_file"
fi
# Run the BATTLE file using Proton with the /passive option
echo "Running BATTLE file using Proton with the /passive option"
"$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net"
# Wait for the process to finish or timeout after a certain number of attempts
max_attempts=20
attempt=0
while true; do
if pgrep -f "Battle.net.exe" || pgrep -f "BlizzardError.exe" > /dev/null; then
pkill -f "Battle.net.exe" || pkill -f "BlizzardError.exe"
break
fi
sleep 1
((attempt++))
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Timeout: Battle.net process did not terminate."
break
fi
done
fi
wait
# wait for Google Chrome to finish
wait
@ -2492,3 +2531,6 @@ fi
# TODO: might be better to relocate temp files to `/tmp` or even use `mktemp -d` since `rm -rf` is potentially dangerous without the `-i` flag
# Delete NonSteamLaunchersInstallation subfolder in Downloads folder
rm -rf "$download_dir"
echo "Script completed successfully."
exit 0