mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Add script for OpenSSL installation (#7337)
This commit is contained in:
committed by
GitHub
parent
078d815ad5
commit
d9b4647e11
40
images/win/scripts/Installers/Install-OpenSSL.ps1
Normal file
40
images/win/scripts/Installers/Install-OpenSSL.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
################################################################################
|
||||
## File: Install-OpenSSL.ps1
|
||||
## Desc: Install win64-openssl.
|
||||
################################################################################
|
||||
|
||||
$arch = "INTEL"
|
||||
$bits = "64"
|
||||
$light = $false
|
||||
$installer = "exe"
|
||||
$version = (Get-ToolsetContent).openssl.version
|
||||
$installDir = "$Env:ProgramFiles\OpenSSL"
|
||||
|
||||
# Fetch available installers list
|
||||
$jsonUrl = 'https://raw.githubusercontent.com/slproweb/opensslhashes/master/win32_openssl_hashes.json'
|
||||
$installersAvailable = @()
|
||||
(Invoke-RestMethod $jsonUrl).files.PSObject.Properties |
|
||||
Where-Object MemberType -Eq NoteProperty |
|
||||
ForEach-Object { $installersAvailable += $_.Value }
|
||||
|
||||
# Select appropriate installers
|
||||
$installersMatching = $installersAvailable | Where-Object {
|
||||
($_.basever -Eq $version -Or $_.basever -Like "$version.*") -And $_.arch -Eq $arch -And $_.bits -Eq $bits -And $_.light -Eq $light -And $_.installer -Eq $installer
|
||||
}
|
||||
|
||||
# Get installer of the latest version
|
||||
$latestInstaller = $installersMatching |
|
||||
Sort-Object { [version]$_.basever }, subver |
|
||||
Select-Object -Last 1
|
||||
|
||||
# Invoke installation
|
||||
$installerUrl = $latestInstaller.url
|
||||
$installerName = "openssl-$($latestInstaller.basever)$($latestInstaller.subver)-setup.$($latestInstaller.installer)"
|
||||
$installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`""
|
||||
Install-Binary -Url "$installerUrl" -Name "$installerName" -ArgumentList $installerArgs
|
||||
|
||||
# Update PATH
|
||||
Add-MachinePathItem "$installDir\bin"
|
||||
$env:Path = Get-MachinePath
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "OpenSSL"
|
||||
Reference in New Issue
Block a user