File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,8 @@ function Confirm-Sha256 {
112112
113113<#
114114. SYNOPSIS
115- Installs a hard-coded version of Chocolatey.
115+ Installs a hard-coded version of Chocolatey. If $Env:WIN_VERSION is "2019",
116+ installs a version compatible with Windows ServerCore 2019.
116117
117118. DESCRIPTION
118119 This function installs a hard-coded version of Chocolatey, by downloading the
@@ -147,8 +148,16 @@ function Install-Chocolatey {
147148 throw
148149 }
149150
151+
150152 $chocolateyVersion = " 2.6.0"
151153 $knownHash = " f13a2af9cd4ec2c9b58d81861bc95ad7151e3a871d8f758dffa72a996a3792d8"
154+ if ($env: WIN_VERSION -eq " 2019" ) {
155+ # Use a version of Chocolatey that works on Windows ServerCore 2019.
156+ # After 1.4.4, Chocolatey requires .NET 4.8, which can't be installed on
157+ # ServerCore 2019.
158+ $chocolateyVersion = " 1.4.4"
159+ $knownHash = " c49fdb49487e0e7a6fdb6d14ffc010630c0b40854942bac13b08bd0e4dac1bf4"
160+ }
152161
153162 $nupkgDirectory = Join-Path - Path $Env: TEMP - ChildPath " nupkg"
154163 $chocoNupkgPath = Get-ChocolateyNupkg - PackageName " chocolatey" - Version $chocolateyVersion - DestinationDirectory $nupkgDirectory
You can’t perform that action at this time.
0 commit comments