@@ -9,6 +9,7 @@ $env:HAB_BLDR_CHANNEL = "base-2025"
99$env: HAB_REFRESH_CHANNEL = " base-2025"
1010$env: CHEF_LICENSE = ' accept-no-persist'
1111$env: HAB_LICENSE = ' accept-no-persist'
12+ $HabitatVersion = if ($env: HAB_VERSION ) { $env: HAB_VERSION } else { ' 1.6.1245' }
1213$Plan = ' chef-cli'
1314
1415Write-Host " --- system details"
@@ -27,8 +28,20 @@ function Stop-HabProcess {
2728
2829# Installing Habitat
2930function Install-Habitat {
30- Write-Host " Downloading and installing Habitat..."
31- Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(' https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1' ))
31+ param (
32+ [Parameter (Mandatory = $true )]
33+ [string ]$Version
34+ )
35+ Write-Host " Downloading and installing Habitat version $Version ..."
36+ $installScriptUrl = ' https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'
37+ $installScriptPath = Join-Path $env: TEMP " hab-install-$Version .ps1"
38+ Invoke-WebRequest - Uri $installScriptUrl - OutFile $installScriptPath
39+ try {
40+ & $installScriptPath - Version $Version
41+ }
42+ finally {
43+ Remove-Item $installScriptPath - Force - ErrorAction SilentlyContinue
44+ }
3245}
3346
3447try {
@@ -51,7 +64,10 @@ catch {
5164 }
5265 }
5366
54- Install-Habitat
67+ Install-Habitat - Version $HabitatVersion
68+ Write-Host " ******************************************************************"
69+ Write-Host " ** What is My Hab Version after installation? $ ( hab -- version) "
70+ Write-Host " ******************************************************************"
5571}
5672finally {
5773 Write-Host " :habicat: I think I have the version I need to build."
@@ -65,6 +81,9 @@ Write-Host "--- Generating fake origin key"
6581hab origin key generate $env: HAB_ORIGIN
6682
6783Write-Host " --- Building $Plan "
84+ Write-Host " ******************************************************************"
85+ Write-Host " ** What is My Project Root as determined by git rev? $ ( git rev- parse -- show-toplevel ) "
86+ Write-Host " ******************************************************************"
6887$project_root = " $ ( git rev- parse -- show-toplevel ) "
6988Set-Location $project_root
7089
0 commit comments