From 676fb590901c7445198f83da458a9afa2ef87bd5 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Mon, 5 Mar 2018 01:58:30 -0800 Subject: [PATCH] Better override support for PS build script Developers can now independently controls XC_OS and XC_ARCH. --- scripts/build.ps1 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 5603ea078..972dcd414 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -53,10 +53,18 @@ if ($LastExitCode -eq 0) { if (Test-Path env:PACKER_DEV) { $XC_OS=$(go.exe env GOOS) $XC_ARCH=$(go.exe env GOARCH) -} -elseif (-not (Test-Path env:XC_ARCH)) { - $XC_ARCH="386 amd64 arm arm64 ppc64le" - $XC_OS="linux darwin windows freebsd openbsd solaris" +} else { + if (Test-Path env:XC_ARCH) { + $XC_ARCH = $(Get-Content env:XC_ARCH) + } else { + $XC_ARCH="386 amd64 arm arm64 ppc64le" + } + + if (Test-Path env:XC_OS) { + $XC_OS = $(Get-Content env:XC_OS) + } else { + $XC_OS = "linux darwin windows freebsd openbsd solaris" + } } # Delete the old dir