Compare commits

..

2 Commits

2 changed files with 18 additions and 20 deletions
Binary file not shown.
+15 -20
View File
@@ -57,28 +57,23 @@ try {
`$urls = $urlLiteral
`$headers = @{ 'User-Agent' = 'Mozilla/5.0' }
if (Test-Path `$jarPath) {
Write-Host "SheepIt client already present at `$jarPath. Skipping download." -ForegroundColor Green
# Always fetch client-latest; cached jars go stale when the farm bumps minimum client version.
`$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) {
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." -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.'
}
if (-not `$downloaded) {
throw 'Unable to download SheepIt client from any known URL.'
}
Write-Host "Starting SheepIt client..." -ForegroundColor Cyan