From c2c5795ed64952b919c6fb93954d937d5074ec13 Mon Sep 17 00:00:00 2001 From: Krzysztof Bogacki Date: Thu, 21 Nov 2019 20:34:43 +0100 Subject: [PATCH 1/3] Allow use of build module on unknown Linux distros --- build.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index bf4a5fbc22e..5d113a4356c 100644 --- a/build.psm1 +++ b/build.psm1 @@ -178,7 +178,7 @@ function Get-EnvironmentInformation $environment.IsSUSEFamily -or $environment.IsAlpine) ) { - throw "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell." + Write-Warning "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell." } } From 4e07fd498c81b2cdd4969092d287ccbac9e34dd7 Mon Sep 17 00:00:00 2001 From: Krzysztof Bogacki Date: Sun, 24 Nov 2019 10:33:49 +0100 Subject: [PATCH 2/3] Require passing an argument to Import-Module to skip Linux distro check --- build.psm1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 5d113a4356c..1525e4973e2 100644 --- a/build.psm1 +++ b/build.psm1 @@ -3,6 +3,11 @@ Set-StrictMode -Version 3.0 +param( + # Skips a check that prevents building PowerShell on unsupported Linux distributions + [parameter(Mandatory = $false)][switch]$SkipLinuxDistroCheck = $false +) + # On Unix paths is separated by colon # On Windows paths is separated by semicolon $script:TestModulePathSeparator = [System.IO.Path]::PathSeparator @@ -178,7 +183,11 @@ function Get-EnvironmentInformation $environment.IsSUSEFamily -or $environment.IsAlpine) ) { - Write-Warning "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell." + if ($SkipLinuxDistroCheck) { + Write-Warning "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell." + } else { + throw "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell. Import this module with '-ArgumentList `$true' to bypass this check." + } } } From 9c88a9920d88f73b79925780f9b7a78932cb3c7e Mon Sep 17 00:00:00 2001 From: Krzysztof Bogacki Date: Thu, 28 May 2020 20:18:08 +0200 Subject: [PATCH 3/3] Move `param` before `Set-StrictMode` --- build.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.psm1 b/build.psm1 index 1525e4973e2..b5759b671f1 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1,13 +1,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -Set-StrictMode -Version 3.0 - param( # Skips a check that prevents building PowerShell on unsupported Linux distributions [parameter(Mandatory = $false)][switch]$SkipLinuxDistroCheck = $false ) +Set-StrictMode -Version 3.0 + # On Unix paths is separated by colon # On Windows paths is separated by semicolon $script:TestModulePathSeparator = [System.IO.Path]::PathSeparator