feat(installer-pwsh): verify ps version is at least 5

This commit is contained in:
James Upjohn 2021-07-13 14:46:56 +12:00
parent 0aedbf248d
commit 0eee712cc5

View file

@ -58,8 +58,21 @@ param(
[Switch]$Help=$false
)
$PSMinSupportedVersion = 10
function Verify-PowerShellVersion {
$PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion | echo)
Write-Host "[$PSVersion]"
if ($PSVersion -lt $PSMinSupportedVersion) {
Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer. Exiting."
exit -1
}
}
function Install-Lepton {
# TODO: implement
Write-Host -NoNewline "Checking PowerShell version... "
Verify-PowerShellVersion # Check installed version meets minimum
}
function Check-Help {