113 lines
3.7 KiB
Bash
Executable File
113 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
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" "/")
|
|
repository_url="https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest"
|
|
eldenring_dir=""
|
|
sc_download_url=""
|
|
local_path=""
|
|
|
|
read -p "Do you want to use the official Github-Repository [d] to download the mod or use an already downloaded .zip? [l] [D/l]: " input
|
|
|
|
if [[ $input == "l" || $input == "L" || $input == "local" || $input == "Local" ]]; then
|
|
echo "Searching Downloads folder..."
|
|
local_path=$(timeout 5 find $HOME/Downloads -iname Seamless*.zip) || true
|
|
|
|
if [[ -f "$local_path" && "$local_path" =~ ^.*Seamless.*.zip$ ]]; then
|
|
echo "File found at $local_path"
|
|
|
|
else
|
|
echo "File not found in $HOME/Downloads"
|
|
read -p "Please specify the path to your local .zip archive: " input
|
|
if [[ -z "$input" || "$input" == "null" ]]; then
|
|
echo "Empty path provided"
|
|
exit 1
|
|
|
|
elif [[ -f "$input" ]]; then
|
|
local_path=$input
|
|
echo "File found at $local_path"
|
|
|
|
elif [[ ! -z "$input" ]]; then
|
|
local_path=$(timeout 5 find $input -iname Seamless*.zip)
|
|
if [[ -f "$local_path" ]]; then
|
|
echo "File found at $local_path"
|
|
else
|
|
echo "File not found at $input"
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
else
|
|
sc_download_url=$(curl -s "https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest" | jq -r '.assets[0].browser_download_url')
|
|
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 folder"
|
|
temp_dir=$(mktemp -d)
|
|
cd "$temp_dir"
|
|
|
|
if [[ -z $sc_download_url && -f $local_path ]]; then
|
|
echo "Copying .zip"
|
|
cp "$local_path" ./seamlesscoop.zip
|
|
else
|
|
echo "Downloading Seamless Coop"
|
|
echo "Download Url: $sc_download_url"
|
|
wget -q -O seamlesscoop.zip "$sc_download_url"
|
|
fi
|
|
|
|
|
|
echo "Unzipping 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"
|