diff --git a/images/win/scripts/Installers/Install-OpenSSL.ps1 b/images/win/scripts/Installers/Install-OpenSSL.ps1 new file mode 100644 index 000000000..ee5f87fc6 --- /dev/null +++ b/images/win/scripts/Installers/Install-OpenSSL.ps1 @@ -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" diff --git a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 index b6a168284..d0edb67bc 100644 --- a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 +++ b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 @@ -46,12 +46,6 @@ Describe "Nuget" { } } -Describe "OpenSSL" { - It "OpenSSL" { - "openssl version" | Should -ReturnZeroExitCode - } -} - Describe "Packer" { It "Packer" { "packer --version" | Should -ReturnZeroExitCode diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 873a41613..26ec41976 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -223,3 +223,9 @@ Describe "SQL OLEDB Driver" { "HKLM:\SOFTWARE\Microsoft\MSOLEDBSQL" | Should -Exist } } + +Describe "OpenSSL" { + It "OpenSSL" { + "openssl version" | Should -ReturnZeroExitCode + } +} diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 4946a0e07..c4b65e076 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -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" } } diff --git a/images/win/toolsets/toolset-2022.json b/images/win/toolsets/toolset-2022.json index ed1b230e3..3c1d624fc 100644 --- a/images/win/toolsets/toolset-2022.json +++ b/images/win/toolsets/toolset-2022.json @@ -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" } } diff --git a/images/win/windows2019.json b/images/win/windows2019.json index 55eaeedb9..03e1a3648 100644 --- a/images/win/windows2019.json +++ b/images/win/windows2019.json @@ -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" ] }, { diff --git a/images/win/windows2022.json b/images/win/windows2022.json index c4dc8f646..2f5a05610 100644 --- a/images/win/windows2022.json +++ b/images/win/windows2022.json @@ -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" ] }, {