Skip to content

Commit 5cc7f80

Browse files
committed
DEBUG
1 parent 7eba5e5 commit 5cc7f80

File tree

1 file changed

+19
-27
lines changed

1 file changed

+19
-27
lines changed

.github/workflows/openssl.ps1

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,38 @@
77
$arch = 'INTEL'
88
$bits = '64'
99
$light = $false
10-
$installer = "exe"
10+
$installerType = "exe"
1111
$version = "3.3.2"
12-
$installDir = "$Env:ProgramFiles\OpenSSL"
12+
$installDir = "$env:ProgramFiles\OpenSSL"
1313

1414
# Fetch available installers list
1515
$jsonUrl = 'https://raw.githubusercontent.com/slproweb/opensslhashes/master/win32_openssl_hashes.json'
1616

1717
$installersAvailable = (Invoke-RestMethod $jsonUrl).files
18+
$installerNames = $installersAvailable | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name
1819

19-
$distributor_file_hash = $null
2020
$installerUrl = $null
21-
$installerName = $null
22-
23-
$installersAvailable | Get-Member -MemberType NoteProperty | ForEach-Object {
24-
$key = $_.Name
25-
if(($installersAvailable.$key.light -eq $light) -and ($installersAvailable.$key.arch -eq $arch) -and ($installersAvailable.$key.bits -eq $bits) -and ($installersAvailable.$key.installer -eq $installer) -and ($installersAvailable.$key.basever -eq $version)) {
26-
$installerUrl = $installersAvailable.$key.url
27-
$installerName = $key
28-
$distributor_file_hash = $installersAvailable.$key.sha512
29-
}
21+
$installerHash = $null
22+
23+
foreach ($key in $installerNames) {
24+
$installer = $installersAvailable.$key
25+
if (($installer.light -eq $light) -and ($installer.arch -eq $arch) -and ($installer.bits -eq $bits) -and ($installer.installer -eq $installerType) -and ($installer.basever -eq $version)) {
26+
$installerUrl = $installer.url
27+
$installerHash = $installer.sha512
28+
}
3029
}
3130

32-
# Invoke installation
33-
34-
$installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`""
35-
Install-Binary -Url "$installerUrl" -Name "$installerName" -ArgumentList $installerArgs
36-
37-
#region Supply chain security
38-
Write-Verbose "Performing checksum verification"
39-
$local_file_hash = (Get-FileHash -Path (Join-Path ${env:TEMP} $installerName) -Algorithm SHA512).Hash
40-
41-
if ($local_file_hash -ne $distributor_file_hash) {
42-
Write-Host "hash must be equal to: ${distributor_file_hash}"
43-
Write-Host "actual hash is: ${local_file_hash}"
44-
throw 'Checksum verification failed, please rerun install'
31+
if ($null -eq $installerUrl) {
32+
throw "Installer not found for version $version"
4533
}
46-
#endregion
34+
35+
Install-Binary `
36+
-Url $installerUrl `
37+
-InstallArgs @('/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`"") `
38+
-ExpectedSHA512Sum $installerHash
4739

4840
# Update PATH
4941
Add-MachinePathItem "$installDir\bin"
50-
$env:Path = Get-MachinePath
42+
Update-Environment
5143

5244
Invoke-PesterTests -TestFile "Tools" -TestName "OpenSSL"

0 commit comments

Comments
 (0)