Improve Ubuntu detection for Ubuntu derivatives like GalliumOS etc (#11155)

This commit is contained in:
Brendan Burns
2019-11-26 15:27:06 -08:00
committed by Travis Plunk
parent cf729c3407
commit 2a76aa10ee
+8 -1
View File
@@ -134,11 +134,18 @@ function Get-EnvironmentInformation
if ($Environment.IsLinux) {
$LinuxInfo = Get-Content /etc/os-release -Raw | ConvertFrom-StringData
$lsb_release = Get-Command lsb_release -Type Application -ErrorAction Ignore
if ($lsb_release) {
$LinuxID = & $lsb_release -is
}
else {
$LinuxID = ""
}
$environment += @{'LinuxInfo' = $LinuxInfo}
$environment += @{'IsDebian' = $LinuxInfo.ID -match 'debian' -or $LinuxInfo.ID -match 'kali'}
$environment += @{'IsDebian9' = $Environment.IsDebian -and $LinuxInfo.VERSION_ID -match '9'}
$environment += @{'IsUbuntu' = $LinuxInfo.ID -match 'ubuntu'}
$environment += @{'IsUbuntu' = $LinuxInfo.ID -match 'ubuntu' -or $LinuxID -match 'Ubuntu'}
$environment += @{'IsUbuntu16' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '16.04'}
$environment += @{'IsUbuntu18' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '18.04'}
$environment += @{'IsCentOS' = $LinuxInfo.ID -match 'centos' -and $LinuxInfo.VERSION_ID -match '7'}