mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Windows] Cleanup various scripts (#8942)
* Use Resolve-GithubReleaseAssetUrl more widely * Add the Get-ChecksumFromUrl function * Sort exported functions and add docs * Remove alias and fix typo * Fix kind checksum url and syntax * Fix checksums url for gh cli and msys2 * [Windows] Cleanup various scripts * Add spaces after type specifications * Rename the Take-Part function
This commit is contained in:
committed by
GitHub
parent
ed911223ab
commit
5ed2615017
@@ -18,9 +18,9 @@ function Mount-RegistryHive {
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$FileName,
|
||||
[string] $FileName,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$SubKey
|
||||
[string] $SubKey
|
||||
)
|
||||
|
||||
Write-Host "Loading the file $FileName to the Key $SubKey"
|
||||
@@ -31,8 +31,7 @@ function Mount-RegistryHive {
|
||||
|
||||
$result = reg load $SubKey $FileName *>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Failed to load file $FileName to the key ${SubKey}: $result"
|
||||
exit 1
|
||||
throw "Failed to load file $FileName to the key ${SubKey}: $result"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +51,7 @@ function Dismount-RegistryHive {
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$SubKey
|
||||
[string] $SubKey
|
||||
)
|
||||
|
||||
Write-Host "Unloading the hive $SubKey"
|
||||
@@ -87,12 +86,12 @@ function Add-MachinePathItem {
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$PathItem
|
||||
[string] $PathItem
|
||||
)
|
||||
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("PATH", "Machine")
|
||||
$newPath = $PathItem + ';' + $currentPath
|
||||
[System.Environment]::SetEnvironmentVariable("PATH", $newPath, "Machine")
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, "Machine")
|
||||
}
|
||||
|
||||
function Add-DefaultPathItem {
|
||||
@@ -120,7 +119,7 @@ function Add-DefaultPathItem {
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$PathItem
|
||||
[string] $PathItem
|
||||
)
|
||||
|
||||
Mount-RegistryHive `
|
||||
|
||||
Reference in New Issue
Block a user