mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Rename image build scripts (#8808)
This commit is contained in:
committed by
GitHub
parent
f78a7baa80
commit
0263bdd53e
36
images/windows/scripts/build/Install-Chocolatey.ps1
Normal file
36
images/windows/scripts/build/Install-Chocolatey.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
################################################################################
|
||||
## File: Install-Chocolatey.ps1
|
||||
## Desc: Install Chocolatey package manager
|
||||
################################################################################
|
||||
|
||||
Write-Host "Set TLS1.2"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||
|
||||
Write-Host "Install chocolatey"
|
||||
$chocoExePath = 'C:\ProgramData\Chocolatey\bin'
|
||||
|
||||
# Add to system PATH
|
||||
$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine)
|
||||
$systemPath += ';' + $chocoExePath
|
||||
[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
# Update local process' path
|
||||
$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User)
|
||||
if ($userPath) {
|
||||
$env:Path = $systemPath + ";" + $userPath
|
||||
} else {
|
||||
$env:Path = $systemPath
|
||||
}
|
||||
|
||||
# Verify and run choco installer
|
||||
$signatureThumbprint = "83AC7D88C66CB8680BCE802E0F0F5C179722764B"
|
||||
$InstallScriptPath = Start-DownloadWithRetry -Url 'https://chocolatey.org/install.ps1'
|
||||
Test-FileSignature -FilePath $InstallScriptPath -ExpectedThumbprint $signatureThumbprint
|
||||
Invoke-Expression $InstallScriptPath
|
||||
|
||||
# Turn off confirmation
|
||||
choco feature enable -n allowGlobalConfirmation
|
||||
|
||||
# Initialize environmental variable ChocolateyToolsLocation by invoking choco Get-ToolsLocation function
|
||||
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force
|
||||
Get-ToolsLocation
|
||||
Reference in New Issue
Block a user