Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3098f2225 |
+11
-5
@@ -96,13 +96,16 @@ function Install-Octopus {
|
|||||||
try {
|
try {
|
||||||
$null = Invoke-WebRequest -Uri $releaseUrl -Method Head -UseBasicParsing -ErrorAction Stop
|
$null = Invoke-WebRequest -Uri $releaseUrl -Method Head -UseBasicParsing -ErrorAction Stop
|
||||||
} catch {
|
} catch {
|
||||||
throw "Release v$specificVersion not found. Available releases: $baseUrl/$REPO/releases"
|
Write-Color "Error: Release v$specificVersion not found." "Red"
|
||||||
|
Write-Color "Available releases: $baseUrl/$REPO/releases" "DarkGray"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Color "Fetching latest version..." "DarkGray"
|
Write-Color "Fetching latest version..." "DarkGray"
|
||||||
$specificVersion = Get-LatestVersion
|
$specificVersion = Get-LatestVersion
|
||||||
if (-not $specificVersion) {
|
if (-not $specificVersion) {
|
||||||
throw "Failed to fetch latest version."
|
Write-Color "Error: Failed to fetch latest version." "Red"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +116,7 @@ function Install-Octopus {
|
|||||||
$installedVersion = & $existing --version 2>$null
|
$installedVersion = & $existing --version 2>$null
|
||||||
if ($installedVersion -eq $specificVersion) {
|
if ($installedVersion -eq $specificVersion) {
|
||||||
Write-Color "Version $specificVersion already installed." "DarkGray"
|
Write-Color "Version $specificVersion already installed." "DarkGray"
|
||||||
return
|
exit 0
|
||||||
} else {
|
} else {
|
||||||
Write-Color "Installed version: $installedVersion" "DarkGray"
|
Write-Color "Installed version: $installedVersion" "DarkGray"
|
||||||
}
|
}
|
||||||
@@ -141,8 +144,10 @@ function Install-Octopus {
|
|||||||
$ProgressPreference = "SilentlyContinue"
|
$ProgressPreference = "SilentlyContinue"
|
||||||
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing
|
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing
|
||||||
} catch {
|
} catch {
|
||||||
|
Write-Color "Error: Failed to download $downloadUrl" "Red"
|
||||||
|
Write-Color $_.Exception.Message "Red"
|
||||||
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
||||||
throw "Failed to download $downloadUrl : $($_.Exception.Message)"
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract
|
# Extract
|
||||||
@@ -152,8 +157,9 @@ function Install-Octopus {
|
|||||||
New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
|
New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
|
||||||
$exeSrc = Join-Path $tmpDir "$APP.exe"
|
$exeSrc = Join-Path $tmpDir "$APP.exe"
|
||||||
if (-not (Test-Path $exeSrc)) {
|
if (-not (Test-Path $exeSrc)) {
|
||||||
|
Write-Color "Error: $APP.exe not found in archive." "Red"
|
||||||
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
||||||
throw "$APP.exe not found in archive."
|
exit 1
|
||||||
}
|
}
|
||||||
Copy-Item -Path $exeSrc -Destination (Join-Path $INSTALL_DIR "$APP.exe") -Force
|
Copy-Item -Path $exeSrc -Destination (Join-Path $INSTALL_DIR "$APP.exe") -Force
|
||||||
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
|
||||||
|
|||||||
Reference in New Issue
Block a user