#!/bin/bash set -euo pipefail search_paths=("$HOME/.steam/steam/steamapps/common" "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common" "$HOME/.local/share/Steam/steamapps/common" "/mnt" "/") eldenring_dir="" #gets latest download url from github sc_download_url=$(curl -s "https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest" | jq -r '.assets[0].browser_download_url') if [[ -z "$sc_download_url" || "$sc_download_url" == "null" ]]; then echo "Failed to retrieve download URL" exit 1 fi echo "Searching for Elden Ring game folder" for i in "${search_paths[@]}"; do echo "Searching at $i" eldenring_dir=$(timeout 5 find "$i" -path '*/Game/*' -iname eldenring.exe -printf '%h\n' -quit 2>/dev/null || true) if [ -n "$eldenring_dir" ]; then read -p "Is this your Elden Ring Game folder? $eldenring_dir [y/N]: " input if [[ $input == "y" || $input == "Y" || $input == "yes" || $input == "Yes" ]]; then break fi eldenring_dir="" fi done if [[ -z "$eldenring_dir" ]]; then input="" read -p "Please provide your Elden Ring Directory Path: " input if test -f "$input/eldenring.exe"; then echo "Correct Elden Ring directory" eldenring_dir=$input echo "$eldenring_dir" else echo "Incorrect Elden Ring directory. 'eldenring.exe' not found at provided path. Exiting..." exit 1 fi fi input="" echo "Creating temp download folder" temp_dir=$(mktemp -d) cd "$temp_dir" echo "Downloading Seamless Coop" echo "Download Url: $sc_download_url" wget -q -O seamlesscoop.zip "$sc_download_url" echo "Unzipping downloaded files" unzip -q seamlesscoop.zip rm seamlesscoop.zip # If seamless coop settings exist in install directory, ask the user whether they want to replace the settings file # If 'no', will delete the empty settings file, so it doesn't get overwritten when copying the files if test -f "$eldenring_dir/ersc_launcher.exe"; then read -p "Override existing Seamless Coop settings? This resets all of your Seamless Coop settings, including multiplayer password [Y/n]: " input if [[ $input == "n" || $input == "N" || $input == "No" || $input == "no" ]]; then rm SeamlessCoop/ersc_settings.ini fi fi echo "Moving source files to Elden Ring Directory" rsync -r --remove-source-files * "$eldenring_dir" echo "Deleting temp download folder" cleanup() { rm -rf "$temp_dir" } trap cleanup EXIT echo "Done"