[macos] Add path variables to packer templates (#9155)

* Update macos-12.pkr.hcl template

* Update remaining macos templates

* Update Get-ToolsetContent and get_toolset_value functions

* Fix ~ symbol expansion issues

* Fix bad path in macOS-14.arm64.anka.pkr.hcl
This commit is contained in:
Shamil Mubarakshin
2024-01-15 12:21:24 +01:00
committed by GitHub
parent 2a7ca2e6a2
commit ba2e955e0b
9 changed files with 904 additions and 855 deletions

View File

@@ -40,9 +40,17 @@ function Get-OSVersion {
}
}
# Get the value of the toolset
function Get-ToolsetContent {
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
<#
.SYNOPSIS
Retrieves the content of the toolset.json file.
.DESCRIPTION
This function reads the toolset.json in path provided by IMAGE_FOLDER
environment variable and returns the content as a PowerShell object.
#>
$toolsetPath = Join-Path $env:IMAGE_FOLDER "toolset.json"
$toolsetJson = Get-Content -Path $toolsetPath -Raw
ConvertFrom-Json -InputObject $toolsetJson
}

View File

@@ -82,7 +82,7 @@ is_Veertu() {
}
get_toolset_value() {
local toolset_path=$(echo "$HOME/image-generation/toolset.json")
local toolset_path=$(echo "$IMAGE_FOLDER/toolset.json")
local query=$1
echo "$(jq -r "$query" $toolset_path)"
}