Skip to content

Commit

Permalink
Update NonSteamLaunchers.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Dec 14, 2024
1 parent c33fbb3 commit fcde7d9
Showing 1 changed file with 61 additions and 21 deletions.
82 changes: 61 additions & 21 deletions NonSteamLaunchers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ function install_gog {
echo "# Downloading & Installing Gog Galaxy...Please wait..."

# Cancel & Exit the GOG Galaxy Setup Wizard
end=$((SECONDS+180)) # Timeout after 180 seconds
end=$((SECONDS+90)) # Timeout after 90 seconds
while true; do
if pgrep -f "GalaxySetup.tmp" > /dev/null; then
pkill -f "GalaxySetup.tmp"
Expand All @@ -1295,36 +1295,76 @@ function install_gog {
sleep 1
done

# Navigate to %LocalAppData%\Temp
temp_dir="${logged_in_home}/.local/share/Steam/steamapps/compatdata/$appid/pfx/drive_c/users/steamuser/AppData/Local/Temp"
if [ -d "$temp_dir" ]; then
cd "$temp_dir"
else
echo "Temp directory does not exist: $temp_dir"
return 1
# Check both Temp directories for Galaxy installer folder
temp_dir1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/$appid/pfx/drive_c/users/steamuser/AppData/Local/Temp"
temp_dir2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/$appid/pfx/drive_c/users/steamuser/Temp"

# First check temp_dir1 (AppData/Local/Temp)
if [ -d "$temp_dir1" ]; then
cd "$temp_dir1"
# Check if we found the installer folder
for dir in GalaxyInstaller_*; do
if [ -d "$dir" ]; then
galaxy_installer_folder="$dir"
break
fi
done
fi

# Find the GalaxyInstaller_XXXXX folder and copy it to C:\Downloads
for dir in GalaxyInstaller_*; do
if [ -d "$dir" ]; then
galaxy_installer_folder="$dir"
break
fi
done
# If not found, check temp_dir2 (Temp)
if [ -z "$galaxy_installer_folder" ] && [ -d "$temp_dir2" ]; then
cd "$temp_dir2"
# Now check if we found the installer folder in the second directory
for dir in GalaxyInstaller_*; do
if [ -d "$dir" ]; then
galaxy_installer_folder="$dir"
break
fi
done
fi

if [ -n "$galaxy_installer_folder" ]; then
cp -r "$galaxy_installer_folder" "${logged_in_home}/Downloads/NonSteamLaunchersInstallation/"
else
echo "Galaxy installer folder not found"
# If no installer folder was found in either directory, exit
if [ -z "$galaxy_installer_folder" ]; then
echo "Galaxy installer folder not found in either Temp directory"
return 1
fi

# Navigate to the C:\Downloads\GalaxyInstaller_XXXXX folder
# Copy the GalaxyInstaller_* folder to Downloads
echo "Found Galaxy installer folder: $galaxy_installer_folder"
cp -r "$galaxy_installer_folder" "${logged_in_home}/Downloads/NonSteamLaunchersInstallation/"

# Navigate to the copied folder in Downloads
cd "${logged_in_home}/Downloads/NonSteamLaunchersInstallation/$(basename "$galaxy_installer_folder")"

# Run GalaxySetup.exe with the /VERYSILENT and /NORESTART options
echo "Running GalaxySetup.exe with the /VERYSILENT and /NORESTART options"
"$STEAM_RUNTIME" "$proton_dir/proton" run GalaxySetup.exe /VERYSILENT /NORESTART
"$STEAM_RUNTIME" "$proton_dir/proton" run GalaxySetup.exe /VERYSILENT /NORESTART &

# Wait for the GalaxySetup.exe to finish running with a timeout of 90 seconds
end=$((SECONDS+90)) # Timeout after 90 seconds
while true; do
# Kill GalaxyClient.exe every 10 seconds if it's running
if [ $((SECONDS % 10)) -eq 0 ]; then
if pgrep -f "GalaxyClient.exe" > /dev/null; then
echo "Killing GalaxyClient.exe"
pkill -f "GalaxyClient.exe"
fi
fi

# Break the loop when GalaxySetup.exe finishes
if ! pgrep -f "GalaxySetup.exe" > /dev/null; then
echo "GalaxySetup.exe has finished running"
break
fi

# Timeout check (90 seconds)
if [ $SECONDS -gt $end ]; then
echo "Timeout while waiting for GalaxySetup.exe to finish"
break
fi

sleep 1
done
}


Expand Down

0 comments on commit fcde7d9

Please sign in to comment.