mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Improve Ubuntu detection for Ubuntu derivatives like GalliumOS etc (#11155)
This commit is contained in:
committed by
Travis Plunk
parent
cf729c3407
commit
2a76aa10ee
+8
-1
@@ -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'}
|
||||
|
||||
Reference in New Issue
Block a user