made minor improvements to the script
This commit is contained in:
+19
-8
@@ -1,8 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
#gets latest download url from github
|
#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')
|
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
|
||||||
|
|
||||||
#find elden ring install path
|
#find elden ring install path
|
||||||
eldenring_dir=$(find / -path '*/Game/*' -iname eldenring.exe -printf '%h\n' -quit 2>/dev/null)
|
eldenring_dir=$(find / -path '*/Game/*' -iname eldenring.exe -printf '%h\n' -quit 2>/dev/null)
|
||||||
|
|
||||||
@@ -13,7 +19,7 @@ if [[ $input == "n" || $input == "N" || $input == "No" || $input == "no" ]]; the
|
|||||||
if test -f "$input/eldenring.exe"; then
|
if test -f "$input/eldenring.exe"; then
|
||||||
echo "Correct Elden Ring directory"
|
echo "Correct Elden Ring directory"
|
||||||
eldenring_dir=$input
|
eldenring_dir=$input
|
||||||
echo $eldenring_dir
|
echo "$eldenring_dir"
|
||||||
else
|
else
|
||||||
echo "Incorrect Elden Ring directory. 'eldenring.exe' not found at provided path. Exiting..."
|
echo "Incorrect Elden Ring directory. 'eldenring.exe' not found at provided path. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -23,16 +29,16 @@ fi
|
|||||||
input=""
|
input=""
|
||||||
|
|
||||||
echo "Creating temp download folder"
|
echo "Creating temp download folder"
|
||||||
mkdir -p ./ersc-download
|
temp_dir=$(mktemp -d)
|
||||||
cd ./ersc-download
|
cd "$temp_dir"
|
||||||
|
|
||||||
echo "Downloading Seamless Coop"
|
echo "Downloading Seamless Coop"
|
||||||
echo "Download Url: $sc_download_url"
|
echo "Download Url: $sc_download_url"
|
||||||
wget -q $sc_download_url
|
wget -q -O seamlesscoop.zip "$sc_download_url"
|
||||||
|
|
||||||
echo "Unzipping downloaded files"
|
echo "Unzipping downloaded files"
|
||||||
unzip -q Seamless*
|
unzip -q seamlesscoop.zip
|
||||||
rm Seamless*.zip
|
rm seamlesscoop.zip
|
||||||
|
|
||||||
# If seamless coop settings exist in install directory, ask the user whether they want to replace the settings file
|
# 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 'no', will delete the empty settings file, so it doesn't get overwritten when copying the files
|
||||||
@@ -47,6 +53,11 @@ echo "Moving source files to Elden Ring Directory"
|
|||||||
rsync -r --remove-source-files * "$eldenring_dir"
|
rsync -r --remove-source-files * "$eldenring_dir"
|
||||||
|
|
||||||
echo "Deleting temp download folder"
|
echo "Deleting temp download folder"
|
||||||
cd ../
|
|
||||||
rm -r ./ersc-download
|
cleanup() {
|
||||||
|
rm -rf "$temp_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|||||||
Reference in New Issue
Block a user