Compare commits
2 Commits
511c1d3e39
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d5f1b5abb4 | |||
| 299226f691 |
Binary file not shown.
@@ -57,28 +57,23 @@ try {
|
|||||||
`$urls = $urlLiteral
|
`$urls = $urlLiteral
|
||||||
`$headers = @{ 'User-Agent' = 'Mozilla/5.0' }
|
`$headers = @{ 'User-Agent' = 'Mozilla/5.0' }
|
||||||
|
|
||||||
if (Test-Path `$jarPath) {
|
# Always fetch client-latest; cached jars go stale when the farm bumps minimum client version.
|
||||||
Write-Host "SheepIt client already present at `$jarPath. Skipping download." -ForegroundColor Green
|
`$downloaded = `$false
|
||||||
|
foreach (`$url in `$urls) {
|
||||||
|
Write-Host "Downloading SheepIt client from `$url..." -ForegroundColor Cyan
|
||||||
|
try {
|
||||||
|
Invoke-WebRequest -Uri `$url -OutFile `$jarPath -UseBasicParsing -Headers `$headers
|
||||||
|
`$downloaded = `$true
|
||||||
|
Write-Host "Download complete -> `$jarPath" -ForegroundColor Green
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host ("Download failed from {0}: {1}" -f `$url, `$_.Exception.Message) -ForegroundColor Yellow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
`$downloaded = `$false
|
|
||||||
|
|
||||||
foreach (`$url in `$urls) {
|
if (-not `$downloaded) {
|
||||||
Write-Host "Downloading SheepIt client from `$url..." -ForegroundColor Cyan
|
throw 'Unable to download SheepIt client from any known URL.'
|
||||||
try {
|
|
||||||
Invoke-WebRequest -Uri `$url -OutFile `$jarPath -UseBasicParsing -Headers `$headers
|
|
||||||
`$downloaded = `$true
|
|
||||||
Write-Host "Download complete." -ForegroundColor Green
|
|
||||||
break
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host ("Download failed from {0}: {1}" -f `$url, `$_.Exception.Message) -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not `$downloaded) {
|
|
||||||
throw 'Unable to download SheepIt client from any known URL.'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Starting SheepIt client..." -ForegroundColor Cyan
|
Write-Host "Starting SheepIt client..." -ForegroundColor Cyan
|
||||||
|
|||||||
Reference in New Issue
Block a user