Compare commits
2 Commits
73505d3087
...
5c0d0fd521
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c0d0fd521 | |||
| 38f5a8285c |
+87
-17
@@ -1,8 +1,54 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$apiUrl = 'https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest'
|
||||
$release = Invoke-RestMethod -Uri $apiUrl -Headers @{ 'User-Agent' = 'PowerShell' }
|
||||
$scDownloadUrl = $release.assets[0].browser_download_url
|
||||
$scDownloadUrl = $null
|
||||
$localPath = $null
|
||||
|
||||
$input = Read-Host "Do you want to use the official Github-Repository [d] to download the mod or use an already downloaded .zip? [l] [D/l]"
|
||||
|
||||
if ($input -match '^(l|local)$') {
|
||||
Write-Host "Searching Downloads folder..."
|
||||
|
||||
$downloads = Join-Path $HOME 'Downloads'
|
||||
|
||||
$localPath = Get-ChildItem -Path $downloads -Filter 'Seamless*.zip' -File -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1 -ExpandProperty FullName
|
||||
|
||||
if ($localPath -and (Test-Path $localPath)) {
|
||||
Write-Host "File found at $localPath"
|
||||
}
|
||||
else {
|
||||
Write-Host "File not found in $downloads"
|
||||
|
||||
$input = Read-Host "Please specify the path to your local .zip archive"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($input) -or $input -eq 'null') {
|
||||
throw "Empty path provided"
|
||||
}
|
||||
elseif (Test-Path $input -PathType Leaf) {
|
||||
$localPath = $input
|
||||
Write-Host "File found at $localPath"
|
||||
}
|
||||
elseif (Test-Path $input -PathType Container) {
|
||||
$localPath = Get-ChildItem -Path $input -Filter 'Seamless*.zip' -File -Recurse -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1 -ExpandProperty FullName
|
||||
|
||||
if ($localPath) {
|
||||
Write-Host "File found at $localPath"
|
||||
}
|
||||
else {
|
||||
throw "File not found at $input"
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw "Invalid path provided"
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$release = Invoke-RestMethod -Uri $apiUrl -Headers @{ 'User-Agent' = 'PowerShell' }
|
||||
$scDownloadUrl = $release.assets[0].browser_download_url
|
||||
}
|
||||
|
||||
function Get-EldenRingGameDir {
|
||||
$steamPaths = @(
|
||||
@@ -12,44 +58,64 @@ function Get-EldenRingGameDir {
|
||||
)
|
||||
|
||||
foreach ($path in $steamPaths) {
|
||||
if (Test-Path (Join-Path $path 'eldenring.exe')) { return $path }
|
||||
if (Test-Path (Join-Path $path 'eldenring.exe')) {
|
||||
$input = Read-Host "Is this your Elden Ring Game folder? $path [Y/n]"
|
||||
|
||||
if ($input -notmatch '^(n|no)$') {
|
||||
return $path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$drives = Get-PSDrive -PSProvider FileSystem | Select-Object -ExpandProperty Root
|
||||
|
||||
foreach ($drive in $drives) {
|
||||
Write-Host "Searching at $drive"
|
||||
|
||||
$hit = Get-ChildItem -Path $drive -Filter 'eldenring.exe' -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -match '\\Elden Ring\\Game\\eldenring\.exe$' } |
|
||||
Select-Object -First 1
|
||||
if ($hit) { return $hit.DirectoryName }
|
||||
|
||||
if ($hit) {
|
||||
$input = Read-Host "Is this your Elden Ring Game folder? $($hit.DirectoryName) [Y/n]"
|
||||
|
||||
if ($input -notmatch '^(n|no)$') {
|
||||
return $hit.DirectoryName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
Write-Host "Searching for Elden Ring game folder"
|
||||
|
||||
$eldenringDir = Get-EldenRingGameDir
|
||||
|
||||
if (-not $eldenringDir) {
|
||||
$eldenringDir = Read-Host "Could not auto-detect your Elden Ring Game folder. Enter the full Game folder path"
|
||||
$eldenringDir = Read-Host "Please provide your Elden Ring Directory Path"
|
||||
|
||||
if (-not (Test-Path (Join-Path $eldenringDir 'eldenring.exe'))) {
|
||||
throw "Incorrect Elden Ring directory. 'eldenring.exe' not found at provided path."
|
||||
}
|
||||
} else {
|
||||
$input = Read-Host "Is this your Elden Ring Game folder? $eldenringDir [Y/n]"
|
||||
if ($input -match '^(n|no)$') {
|
||||
$eldenringDir = Read-Host "Please provide your Elden Ring Game folder path"
|
||||
if (-not (Test-Path (Join-Path $eldenringDir 'eldenring.exe'))) {
|
||||
throw "Incorrect Elden Ring directory. 'eldenring.exe' not found at provided path."
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Correct Elden Ring directory"
|
||||
}
|
||||
|
||||
$tempDir = Join-Path $PWD 'ersc-download'
|
||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
||||
|
||||
Write-Host "Downloading Seamless Coop"
|
||||
Write-Host "Download URL: $scDownloadUrl"
|
||||
$zipPath = Join-Path $tempDir 'ersc.zip'
|
||||
Invoke-WebRequest -Uri $scDownloadUrl -OutFile $zipPath
|
||||
|
||||
if (-not $scDownloadUrl -and $localPath) {
|
||||
Write-Host "Copying .zip"
|
||||
Copy-Item $localPath $zipPath -Force
|
||||
}
|
||||
else {
|
||||
Write-Host "Downloading Seamless Coop"
|
||||
Write-Host "Download URL: $scDownloadUrl"
|
||||
Invoke-WebRequest -Uri $scDownloadUrl -OutFile $zipPath
|
||||
}
|
||||
|
||||
Write-Host "Extracting downloaded files"
|
||||
Expand-Archive -Path $zipPath -DestinationPath $tempDir -Force
|
||||
@@ -59,9 +125,13 @@ $launcherPath = Join-Path $eldenringDir 'ersc_launcher.exe'
|
||||
|
||||
if (Test-Path $launcherPath) {
|
||||
$input = Read-Host "Override existing Seamless Coop settings? This resets your Seamless Coop settings, including multiplayer password [Y/n]"
|
||||
|
||||
if ($input -match '^(n|no)$') {
|
||||
$settings = Join-Path $seamlessDir 'ersc_settings.ini'
|
||||
if (Test-Path $settings) { Remove-Item $settings -Force }
|
||||
|
||||
if (Test-Path $settings) {
|
||||
Remove-Item $settings -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -1,4 +1,5 @@
|
||||
#!/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" "/")
|
||||
repository_url="https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest"
|
||||
@@ -10,11 +11,11 @@ read -p "Do you want to use the official Github-Repository [d] to download the m
|
||||
|
||||
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
|
||||
local_path=$(timeout 5 find "$HOME/Downloads" -iname Seamless*.zip) || true
|
||||
|
||||
if [[ -f "$local_path" && "$local_path" =~ ^.*Seamless.*.zip$ ]]; then
|
||||
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
|
||||
@@ -27,7 +28,7 @@ if [[ $input == "l" || $input == "L" || $input == "local" || $input == "Local" ]
|
||||
echo "File found at $local_path"
|
||||
|
||||
elif [[ ! -z "$input" ]]; then
|
||||
local_path=$(timeout 5 find $input -iname Seamless*.zip)
|
||||
local_path=$(timeout 5 find "$input" -iname Seamless*.zip)
|
||||
if [[ -f "$local_path" ]]; then
|
||||
echo "File found at $local_path"
|
||||
else
|
||||
@@ -73,6 +74,12 @@ input=""
|
||||
|
||||
echo "Creating temp folder"
|
||||
temp_dir=$(mktemp -d)
|
||||
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$temp_dir"
|
||||
}
|
||||
|
||||
cd "$temp_dir"
|
||||
|
||||
if [[ -z $sc_download_url && -f $local_path ]]; then
|
||||
@@ -103,10 +110,6 @@ rsync -r --remove-source-files * "$eldenring_dir"
|
||||
|
||||
echo "Deleting temp download folder"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$temp_dir"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Done"
|
||||
|
||||
Reference in New Issue
Block a user