Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Public/OSDCloud.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,27 @@
Write-Warning "[$(Get-Date -format G)] OSDCloud Warning"
Write-Warning "No SHA1 Hash exists for $($Global:OSDCloud.ImageFileName) in the OSDCloud Catalog"
Write-Warning "Skipping SHA1 Validation"
## PATCHED for SHA256 START (Pre_OSDCloud_v2)
# If SHA1 is not available, verify the ESD using SHA256 instead.
Write-Warning "Attempting validation using SHA256 instead"
$Patched_ImageFileDestinationSHA256 = (Get-FileHash -Path $Global:OSDCloud.ImageFileDestination.FullName -Algorithm SHA256).Hash
$Patched_ImageFileSHA256 = (Get-OSDCloudOperatingSystems | Where-Object {$_.FileName -eq "$($Global:OSDCloud.ImageFileName)"}).Sha256
if (-Not $Patched_ImageFileSHA256) {
Write-Warning "No SHA256 Hash exists for $($Global:OSDCloud.ImageFileName) in the OSDCloud Catalog"
Write-Warning "Skipping SHA256 Validation"
} elseif ($Patched_ImageFileDestinationSHA256 -ne $Patched_ImageFileSHA256) {
Write-Warning "SHA256 Mismatch"
Write-Warning "Downloaded ESD SHA256: $($Patched_ImageFileDestinationSHA256)"
Write-Warning "Catalog ESD SHA256: $(($Patched_ImageFileSHA256).ToUpper())"
Write-Warning "Press Ctrl+C to exit"
Start-Sleep -Seconds 86400
Exit
} else {
Write-Host -ForegroundColor Green "SHA256 Match"
Write-Host -ForegroundColor DarkGray " Catalog ESD SHA256: $(($Patched_ImageFileSHA256).ToUpper())"
Write-Host -ForegroundColor DarkGray " Downloaded ESD SHA256: $($Patched_ImageFileDestinationSHA256)"
}
# End of SHA256 fallback verification.
}
elseif ($Global:OSDCloud.ImageFileDestinationSHA1 -ne $Global:OSDCloud.ImageFileSHA1){
Write-Warning "SHA1 Mismatch"
Expand Down
Loading