made the backup update script fail faster

This commit is contained in:
2026-11-17 00:36:59 -05:00
parent 467f699103
commit bfdf8f5eae
5 changed files with 76 additions and 28 deletions
+20 -7
View File
@@ -886,19 +886,32 @@ Function Disable-Log {
}
# Published packages for both Install- and Update-EmberkomCloudBackup.
Function Get-EmberkomCloudBackupRelease {
param([Parameter(Mandatory=$true)][ValidateSet('Windows','VM')][string]$Build)
Function Get-EmberkomCloudBackupReleases {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$client = New-Object Net.WebClient
try {
$json = $client.DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/EmberkomCloudBackup.json')
} finally { $client.Dispose() }
$release = ($json | ConvertFrom-Json -ErrorAction Stop).$Build
if ($release.Version -notmatch '^\d+\.\d+\.\d+\.\d+$' -or $release.Url -notmatch '^https://' -or
$release.SHA256 -notmatch '^[a-f0-9]{64}$') {
throw "Incomplete Emberkom Cloud Backup release for $Build."
$manifest = $json | ConvertFrom-Json -ErrorAction Stop
$releases = @{}
foreach ($build in 'Windows','VM') {
$release = $manifest.$build
$version = $null
if ([version]::TryParse($release.Version, [ref]$version) -and $version.Revision -ge 0 -and $release.Url -match '^https://' -and
$release.SHA256 -match '^[a-f0-9]{64}$') {
$releases[$build] = $release
}
}
return $release
return $releases
}
Function Get-EmberkomCloudBackupRelease {
param(
[Parameter(Mandatory=$true)][ValidateSet('Windows','VM')][string]$Build,
[hashtable]$Releases = (Get-EmberkomCloudBackupReleases)
)
if (!$Releases[$Build]) { throw "Incomplete Emberkom Cloud Backup release for $Build." }
return $Releases[$Build]
}
Function Save-EmberkomCloudBackupInstaller {