diff options
author | John McCrae <john.mccrae@progress.com> | 2022-10-20 16:22:04 +0600 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2022-10-20 16:34:54 +0600 |
commit | a3c439412e1d694b37d9f1bfa1bb696102976e38 (patch) | |
tree | 81d4956b42cd5d121e330e027e60459400df6e54 | |
parent | a9e09c39152a92b00e87c03e71c9b2f550ed411d (diff) | |
download | chef-a3c439412e1d694b37d9f1bfa1bb696102976e38.tar.gz |
Cleaning up, solved the Hab installation issue
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r-- | .expeditor/scripts/ensure-minimum-viable-hab.ps1 | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 index db3ebc4d59..96ec67142d 100644 --- a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 +++ b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 @@ -1,47 +1,17 @@ try { [Version]$hab_version = (hab --version).split(" ")[1].split("/")[0] if ($hab_version -lt [Version]"0.85.0" ) { - # $foo = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) - # $foo.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") - Write-Host "--- :habicat: Installing the version of Habitat required" - Write-Host "What version of Windows and PowerShell is this?`n" - $PSVersionTable - Write-Host "`n" - Write-Host "This is the OS Version" - [System.Environment]::OSVersion - Write-Host "What version of Hab is this? $((hab --version).split(" ")[1].split("/")[0])" - Write-Host "`n" - Get-Command Hab - Set-ExecutionPolicy Bypass -Scope Process -Force - # choco feature enable -n=allowGlobalConfirmation - # choco install habitat Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1')) $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") - $test_output = Get-ChildItem -path c:\ -File "hab.exe" -Recurse -ErrorAction SilentlyContinue - Write-Host "Here's Hab`n" - Write-Host $test_output if (-not $?) { throw "Hab version is older than 0.85 and could not update it." } } else { Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed" } } catch { - Write-Host "What version of Windows and PowerShell is this?`n" - Write-Host "`n" - $PSVersionTable - [System.Environment]::OSVersion - Write-Host "`n" - Write-Host "Looking for Hab in all the wrong places" - Get-Command Hab - Write-Host "`n" - # This install fails if Hab isn't on the path when we check for the version. This ensures it is installed Write-Host "--- :habicat: Forcing an install of habitat" Set-ExecutionPolicy Bypass -Scope Process -Force choco feature enable -n=allowGlobalConfirmation choco install habitat - # Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1')) - $test_output = Get-ChildItem -path c:\ -File "hab.exe" -Recurse -ErrorAction SilentlyContinue - Write-Host "Here's Hab`n" - Write-Host $test_output $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + ";C:\ProgramData\Habitat\" } |