[Windows] Add script for OpenSSL installation (#7337)

This commit is contained in:
Vasilii Polikarpov
2023-03-28 10:42:14 +02:00
committed by GitHub
parent 078d815ad5
commit d9b4647e11
7 changed files with 56 additions and 16 deletions

View 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"

View File

@@ -46,12 +46,6 @@ Describe "Nuget" {
}
}
Describe "OpenSSL" {
It "OpenSSL" {
"openssl version" | Should -ReturnZeroExitCode
}
}
Describe "Packer" {
It "Packer" {
"packer --version" | Should -ReturnZeroExitCode

View File

@@ -223,3 +223,9 @@ Describe "SQL OLEDB Driver" {
"HKLM:\SOFTWARE\Microsoft\MSOLEDBSQL" | Should -Exist
}
}
Describe "OpenSSL" {
It "OpenSSL" {
"openssl version" | Should -ReturnZeroExitCode
}
}

View File

@@ -454,10 +454,6 @@
{ "name": "innosetup" },
{ "name": "jq" },
{ "name": "NuGet.CommandLine" },
{
"name": "openssl.light",
"args": [ "--version=1.1.1.20181020" ]
},
{ "name": "packer" },
{ "name": "strawberryperl" },
{ "name": "pulumi" },
@@ -502,5 +498,8 @@
"kotlin": {
"version": "latest",
"binary_name": "kotlin-compiler"
},
"openssl": {
"version": "1.1.1"
}
}

View File

@@ -365,10 +365,6 @@
{ "name": "innosetup" },
{ "name": "jq" },
{ "name": "NuGet.CommandLine" },
{
"name": "openssl.light",
"args": [ "--version=1.1.1.20181020" ]
},
{ "name": "packer" },
{ "name": "strawberryperl" },
{ "name": "pulumi" },
@@ -413,5 +409,8 @@
"kotlin": {
"version": "latest",
"binary_name": "kotlin-compiler"
},
"openssl": {
"version": "1.1.1"
}
}

View File

@@ -185,7 +185,8 @@
"{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-CommonUtils.ps1",
"{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1",
"{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1"
"{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1",
"{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1"
]
},
{

View File

@@ -191,7 +191,8 @@
"{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-CommonUtils.ps1",
"{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1",
"{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1"
"{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1",
"{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1"
]
},
{