From 85580b7d5ba9b3f0e4a1be0e0b07afd68ca7f9fc Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Thu, 21 Nov 2019 22:30:32 -0800 Subject: [PATCH] Improve Ubuntu detection for Ubuntu derivatives like GalliumOS etc. --- build.psm1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 6f79686ef6c..40a1b3aa3c6 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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'}