diff --git a/.spelling b/.spelling
index 47ef3542f3b..c988a226942 100644
--- a/.spelling
+++ b/.spelling
@@ -184,6 +184,7 @@ TeamCity
thenewstellw
throttlelimit
toolset
+toolchain
TraceSource
Unregister-Event
Unregister-PSSessionConfiguration
@@ -419,14 +420,6 @@ _script.ps1
_script.ps1.
#endregion
-#region demos/Raspberry-Pi/README.md Overrides
- - demos/Raspberry-Pi/README.md
-2.0.x
-2.1.x
-Raspbian
-toolchain
-#endregion
-
#region demos/rest/README.md Overrides
- demos/rest/README.md
rest.ps1
@@ -959,6 +952,7 @@ msi
omnisharp-vscode
opencode
pkg
+tgz
UserVoice
#endregion
diff --git a/.travis.yml b/.travis.yml
index 7a3907b275b..389e2c52099 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,14 +3,13 @@ language: cpp
git:
depth: 1000
-os:
- - linux
- - osx
-sudo: required
-dist: trusty
-osx_image: xcode8.1
-
matrix:
+ include:
+ - os: linux
+ dist: trusty
+ sudo: required
+ - os: osx
+ osx_image: xcode8.1
fast_finish: true
addons:
diff --git a/.vscode/settings.json b/.vscode/settings.json
index b8279a4f500..792e547d8a5 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -18,5 +18,20 @@
"[powershell]": {
"files.trimTrailingWhitespace": true
- }
+ },
+
+ // Sets the codeformatting options to follow the given indent style in a way that is compatible with PowerShell syntax. For more information about the brace styles please refer to https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/81.
+ "powershell.codeFormatting.preset": "OTBS",
+
+ // Adds a space between a keyword and its associated scriptblock expression.
+ "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
+
+ // Adds a space between a keyword (if, elseif, while, switch, etc) and its associated conditional expression.
+ "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
+
+ // Adds spaces before and after an operator ('=', '+', '-', etc.).
+ "powershell.codeFormatting.whitespaceAroundOperator": true,
+
+ // Adds a space after a separator (',' and ';').
+ "powershell.codeFormatting.whitespaceAfterSeparator": true
}
diff --git a/README.md b/README.md
index 56269c6f326..89e59a330c0 100644
--- a/README.md
+++ b/README.md
@@ -44,6 +44,7 @@ You can download and install a PowerShell package for any of the following platf
| macOS 10.12 | [.pkg][rl-macos] | [Instructions][in-macos] |
| Docker | | [Instructions][in-docker] |
| Kali Linux | [.deb][rl-ubuntu16] | [Instructions][in-kali] |
+| Raspbian (Stretch) | [.tgz][rl-raspbian] | [Instructions][in-raspbian] |
You can also download the PowerShell binary archives for Windows, macOS and Linux.
@@ -67,6 +68,7 @@ You can also download the PowerShell binary archives for Windows, macOS and Linu
[rl-winx64-zip]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/PowerShell-6.0.0-rc-win-x64.zip
[rl-macos-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-osx-x64.tar.gz
[rl-linux-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-linux-x64.tar.gz
+[rl-raspbian]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-linux-arm32.tar.gz
[installation]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation
[in-windows]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation/windows.md#msi
@@ -87,6 +89,7 @@ You can also download the PowerShell binary archives for Windows, macOS and Linu
[in-kali]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation/linux.md#kali
[in-windows-zip]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation/windows.md#zip
[in-tar]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation/linux.md#binary-archives
+[in-raspbian]: https://github.com/PowerShell/PowerShell/tree/master/docs/installation/linux.md#raspbian
To install a specific version, visit [releases](https://github.com/PowerShell/PowerShell/releases).
diff --git a/build.psm1 b/build.psm1
index 60142869d8e..d770d53e530 100644
--- a/build.psm1
+++ b/build.psm1
@@ -510,7 +510,7 @@ Fix steps:
# Handle TypeGen
# .inc file name must be different for Windows and Linux to allow build on Windows and WSL.
$incFileName = "powershell_$($Options.Runtime).inc"
- if ($TypeGen -or -not (Test-Path "$PSScriptRoot/TypeCatalogGen/$incFileName")) {
+ if ($TypeGen -or -not (Test-Path "$PSScriptRoot/src/TypeCatalogGen/$incFileName")) {
log "Run TypeGen (generating CorePsTypeCatalog.cs)"
Start-TypeGen -IncFileName $incFileName
}
diff --git a/demos/Raspberry-Pi/README.md b/demos/Raspberry-Pi/README.md
deleted file mode 100644
index 6a6a5fff1c8..00000000000
--- a/demos/Raspberry-Pi/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# Running PowerShell Core 6 on a Raspberry-Pi
-
-## Setup your Pi
-
-Note that CoreCLR (and thus PowerShell Core) will only work on Pi 2 and Pi 3 devices as other devices
-like [Pi Zero](https://github.com/dotnet/coreclr/issues/10605) have an unsupported processor.
-
-Download [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) and follow the [installation instructions](https://www.raspberrypi.org/documentation/installation/installing-images/README.md) to get it onto your Pi.
-
-Once your Pi is up and running, [enable SSH remoting](https://www.raspberrypi.org/documentation/remote-access/ssh/).
-
-## Building PowerShell Core 6 for arm32
-
-We'll need to cross-compile for the Linux arm32 architecture from Ubuntu.
-
-Follow the [Linux instructions to Build PowerShell](https://github.com/PowerShell/PowerShell/blob/master/docs/building/linux.md).
-
-Once your environment is working, you'll need to setup the toolchain for cross compilation:
-
-```powershell
-Start-PSBootstrap -BuildLinuxArm
-```
-
-You can now build PowerShell Core:
-
-```powershell
-Start-PSBuild -Clean -Runtime linux-arm -PSModuleRestore
-```
-
-Note that it's important to do a `-Clean` build because if you previously built for Ubuntu, it won't try to rebuild the native library `pslnative` for arm32.
-
-## Copy the bits to your Pi
-
-Use SSH to copy the bits remotely, replace `yourPi` with the name or IP address of your Pi.
-
-```powershell
-scp -r "$(split-path (Get-PSOutput))/*" pi@yourPi:/home/pi/powershell
-```
-
-## Get latest CoreCLR runtime
-
-We need to get a CoreCLR that fixes a [threading bug](https://github.com/dotnet/coreclr/pull/13922) which is in DotNetCore 2.0.0.
-
-You can do these steps locally on your Pi, but we're using SSH remoting here.
-
-We'll be using the latest [build](https://github.com/dotnet/core-setup#daily-builds) from master which has the fix.
-Note that at the time of authoring these instructions, the 2.0.x servicing build didn't have the necessary fix and the 2.1.x builds may be more unstable.
-
-We'll use `curl` to get the latest DotNetCore runtime.
-
-```bash
-sudo apt install curl
-```
-
-Now we'll download it and unpack it.
-
-```bash
-# Connect to your Pi.
-ssh pi@yourpi
-# We'll make a folder to put latest CoreCLR runtime.
-mkdir dotnet
-cd dotnet
-# Download the latest CoreCLR runtime.
-curl -O https://dotnetcli.blob.core.windows.net/dotnet/Runtime/master/dotnet-runtime-latest-linux-arm.tar.gz
-# Unpack it.
-tar xvf ./dotnet-runtime-latest-linux-arm.tar.gz
-# We're going to overwrite the CoreCLR bits we built with newer ones, replace the version named folder below as appropriate.
-# If you build a newer version of PowerShell Core, you'll need to make sure you get latest CoreCLR runtime otherwise you may hit a segmentation fault.
-cp shared/Microsoft.NetCore.App/2.1.0-preview1-25719-04/* ~/powershell
-```
-
-## Start PowerShell
-
-```bash
-~/powershell/pwsh
-```
-
-Note that until arm32 is [fully supported by CoreCLR](https://github.com/dotnet/coreclr/issues/3977), it's not supported by PowerShell Core.
-
-If you get an error complaining about `libunwind.so.8` not being found, you'll need to install it as it's required by CoreCLR.
-
-```bash
-sudo apt install libunwind8
-```
-
-Have fun!
diff --git a/docs/installation/linux.md b/docs/installation/linux.md
index a451eb9398c..a3e31810d9e 100644
--- a/docs/installation/linux.md
+++ b/docs/installation/linux.md
@@ -672,6 +672,35 @@ chmod a+x powershell-6.0.0-rc-x86_64.AppImage
dpkg -r powershell_6.0.0-rc-1.ubuntu.16.04_amd64.deb
```
+## Raspbian
+
+Currently, PowerShell is only supported on Raspbian Stretch.
+
+### Installation
+
+```sh
+# Install prerequisites
+sudo apt-get install libunwind8
+
+# Grab the latest tar.gz
+wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-linux-arm32.tar.gz
+
+# Make folder to put powershell
+mkdir ~/powershell
+
+# Unpack the tar.gz file
+tar -xvf ./powershell-6.0.0-rc-linux-arm32.tar.gz -C ~/powershell
+
+# Start PowerShell
+~/powershell/pwsh
+```
+
+### Uninstallation - Raspbian
+
+```sh
+rm -rf ~/powershell
+```
+
## Binary Archives
PowerShell binary `tar.gz` archives are provided for macOS and Linux platforms to enable advanced deployment scenarios.
diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs
index fd9cf08a69f..2109c6b2d0e 100644
--- a/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs
+++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs
@@ -12,50 +12,50 @@ namespace System.Management.Automation
using System;
///
- /// Possible types of CompletionResults
+ /// Possible types of CompletionResults.
///
public enum CompletionResultType
{
- /// An unknown result type, kept as text only
+ /// An unknown result type, kept as text only.
Text = 0,
- /// A history result type like the items out of get-history
+ /// A history result type like the items out of get-history.
History = 1,
- /// A command result type like the items out of get-command
+ /// A command result type like the items out of get-command.
Command = 2,
- /// A provider item
+ /// A provider item.
ProviderItem = 3,
- /// A provider container
+ /// A provider container.
ProviderContainer = 4,
- /// A property result type like the property items out of get-member
+ /// A property result type like the property items out of get-member.
Property = 5,
- /// A method result type like the method items out of get-member
+ /// A method result type like the method items out of get-member.
Method = 6,
- /// A parameter name result type like the Parameters property out of get-command items
+ /// A parameter name result type like the Parameters property out of get-command items.
ParameterName = 7,
- /// A parameter value result type
+ /// A parameter value result type.
ParameterValue = 8,
- /// A variable result type like the items out of get-childitem variable:
+ /// A variable result type like the items out of get-childitem variable.
Variable = 9,
- /// A namespace
+ /// A namespace.
Namespace = 10,
- /// A type name
+ /// A type name.
Type = 11,
- /// A keyword
+ /// A keyword.
Keyword = 12,
- /// A dynamic keyword
+ /// A dynamic keyword.
DynamicKeyword = 13,
// If a new enum is added, there is a range test that uses DynamicKeyword for parameter validation
@@ -64,37 +64,37 @@ public enum CompletionResultType
}
///
- /// Class used to store a tab completion or Intellisense result
+ /// Class used to store a tab completion or Intellisense result.
///
public class CompletionResult
{
///
- /// Text to be used as the auto completion result
+ /// Text to be used as the auto completion result.
///
private string _completionText;
///
- /// Text to be displayed in a list
+ /// Text to be displayed in a list.
///
private string _listItemText;
///
- /// The text for the tooltip with details to be displayed about the object
+ /// The text for the tooltip with details to be displayed about the object.
///
private string _toolTip;
///
- /// Type of completion result
+ /// Type of completion result.
///
private CompletionResultType _resultType;
///
- /// Private member for null instance
+ /// Private member for null instance.
///
private static readonly CompletionResult s_nullInstance = new CompletionResult();
///
- /// Gets the text to be used as the auto completion result
+ /// Gets the text to be used as the auto completion result.
///
public string CompletionText
{
@@ -109,7 +109,7 @@ public string CompletionText
}
///
- /// Gets the text to be displayed in a list
+ /// Gets the text to be displayed in a list.
///
public string ListItemText
{
@@ -124,7 +124,7 @@ public string ListItemText
}
///
- /// Gets the type of completion result
+ /// Gets the type of completion result.
///
public CompletionResultType ResultType
{
@@ -139,7 +139,7 @@ public CompletionResultType ResultType
}
///
- /// Gets the text for the tooltip with details to be displayed about the object
+ /// Gets the text for the tooltip with details to be displayed about the object.
///
public string ToolTip
{
@@ -154,7 +154,7 @@ public string ToolTip
}
///
- /// Gets the null instance of type CompletionResult
+ /// Gets the null instance of type CompletionResult.
///
internal static CompletionResult Null
{
@@ -162,12 +162,12 @@ internal static CompletionResult Null
}
///
- /// Initializes a new instance of the CompletionResult class
+ /// Initializes a new instance of the CompletionResult class.
///
- /// the text to be used as the auto completion result
- /// he text to be displayed in a list
- /// the type of completion result
- /// the text for the tooltip with details to be displayed about the object
+ /// The text to be used as the auto completion result.
+ /// The text to be displayed in a list.
+ /// The type of completion result.
+ /// The text for the tooltip with details to be displayed about the object.
public CompletionResult(string completionText, string listItemText, CompletionResultType resultType, string toolTip)
{
if (String.IsNullOrEmpty(completionText))
@@ -198,9 +198,9 @@ public CompletionResult(string completionText, string listItemText, CompletionRe
///
- /// Initializes a new instance of this class internally if the result out of TabExpansion is a string
+ /// Initializes a new instance of this class internally if the result out of TabExpansion is a string.
///
- /// completion text
+ /// Completion text.
public CompletionResult(string completionText)
: this(completionText, completionText, CompletionResultType.Text, completionText)
{
diff --git a/src/System.Management.Automation/resources/ParameterBinderStrings.resx b/src/System.Management.Automation/resources/ParameterBinderStrings.resx
index 1edbbba226e..8c49becc278 100644
--- a/src/System.Management.Automation/resources/ParameterBinderStrings.resx
+++ b/src/System.Management.Automation/resources/ParameterBinderStrings.resx
@@ -142,7 +142,7 @@
Cannot bind positional parameters because no names were given.
- Parameter set cannot be resolved using the specified named parameters.
+ Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
Cannot process command because of one or more missing mandatory parameters:{1}.
diff --git a/src/libpsl-native/src/followsymlink.cpp b/src/libpsl-native/src/followsymlink.cpp
index 6f32d697d77..033160fae67 100644
--- a/src/libpsl-native/src/followsymlink.cpp
+++ b/src/libpsl-native/src/followsymlink.cpp
@@ -39,7 +39,7 @@ char* FollowSymLink(const char* fileName)
if (realPath)
{
- return strndup(realPath, strlen(realPath) + 1);
+ return strndup(realPath, strnlen(realPath, PATH_MAX));
}
// if the path wasn't resolved, use readlink
diff --git a/src/libpsl-native/src/getfullyqualifiedname.cpp b/src/libpsl-native/src/getfullyqualifiedname.cpp
index 75e5af4b367..12a3483ed7c 100644
--- a/src/libpsl-native/src/getfullyqualifiedname.cpp
+++ b/src/libpsl-native/src/getfullyqualifiedname.cpp
@@ -43,7 +43,7 @@ char *GetFullyQualifiedName()
}
// return the first canonical name in the list
- fullName = strndup(info->ai_canonname, strlen(info->ai_canonname));
+ fullName = strndup(info->ai_canonname, strnlen(info->ai_canonname, NI_MAXHOST));
// only free info if getaddrinfo was successful
freeaddrinfo(info);
diff --git a/src/libpsl-native/test/test-createsymlink.cpp b/src/libpsl-native/test/test-createsymlink.cpp
index 9bd96f346f3..42f186b2951 100644
--- a/src/libpsl-native/test/test-createsymlink.cpp
+++ b/src/libpsl-native/test/test-createsymlink.cpp
@@ -92,7 +92,7 @@ TEST_F(CreateSymLinkTest, SymLinkToFile)
std::string target = FollowSymLink(fileSymLink.c_str());
char buffer[PATH_MAX];
std::string expected = realpath(file, buffer);
- EXPECT_EQ(target, expected);
+ EXPECT_EQ(expected, target);
}
TEST_F(CreateSymLinkTest, SymLinkToDirectory)
@@ -103,7 +103,7 @@ TEST_F(CreateSymLinkTest, SymLinkToDirectory)
std::string target = FollowSymLink(dirSymLink.c_str());
char buffer[PATH_MAX];
std::string expected = realpath(dir, buffer);
- EXPECT_EQ(target, expected);
+ EXPECT_EQ(expected, target);
}
TEST_F(CreateSymLinkTest, SymLinkAgain)
diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.def b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.def
index af45f5c785a..ef1208d3875 100644
--- a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.def
+++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.def
@@ -15,4 +15,3 @@ WSManPluginSend
WSManPluginSignal
WSManPluginReceive
WSManPluginConnect
-PerformWSManPluginReportCompletion
diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h
index 7d2f25d94fe..5721e80ceaf 100644
--- a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h
+++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h
@@ -26,10 +26,6 @@ using namespace NativeMsh;
// Forward declaration of class PwrshPlugIn
class PwrshPlugIn;
-// To report the plugin completion using WSManPluginReportCompletion API
-// g_pPluginContext MUST be the same context that plugin provided to the WSManPluginStartup method
-PwrshPlugIn* g_pPluginContext;
-
class PwrshPlugIn
{
private:
@@ -230,7 +226,6 @@ class PwrshPlugInMediator
// storing the extra info for plugin use later.
VerifyAndStoreExtraInfo(extraInfo, &initParameters);
PwrshPlugIn* result = new PwrshPlugIn(applicationIdentification, initParameters);
- g_pPluginContext = result;
return result;
}
@@ -1090,13 +1085,3 @@ class PwrshPlugInMediator
return version;
}
};
-
-extern "C"
-void WINAPI PerformWSManPluginReportCompletion()
-{
- // Now report the plugin completion, to indicate that plugin is ready to shutdown.
- // This API is used by plugins to report completion
- // - pluginContext MUST be the same context that plugin provided to the WSManPluginStartup method
- // - flags are reserved, so 0
- WSManPluginReportCompletion(g_pPluginContext, 0);
-}
diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1
index c53bced0227..1ddc40d5c2f 100644
--- a/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1
+++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1
@@ -125,7 +125,7 @@
Context "Import-CliXML" {
BeforeAll {
- $gpsList = Get-Process powershell
+ $gpsList = Get-Process pwsh
$gps = $gpsList | Select-Object -First 1
$filePath = Join-Path $subFilePath 'gps.xml'
@@ -161,7 +161,9 @@
$fileContent | Should Not Be $null
$importedProcess = Import-Clixml $filePath
+ $importedProcess.ProcessName | Should Not BeNullOrEmpty
$gps.ProcessName | Should Be $importedProcess.ProcessName
+ $importedProcess.Id | Should Not BeNullOrEmpty
$gps.Id | Should Be $importedProcess.Id
}
@@ -173,7 +175,9 @@
$fileContent | Should Not Be $null
$importedProcess = Import-Clixml $filePath
+ $importedProcess.ProcessName | Should Not BeNullOrEmpty
$gps.ProcessName | Should Be $importedProcess.ProcessName
+ $importedProcess.Id | Should Not BeNullOrEmpty
$gps.Id | Should Be $importedProcess.Id
}
diff --git a/tools/install-powershell.ps1 b/tools/install-powershell.ps1
index d614d512d6e..fac01dc1c48 100644
--- a/tools/install-powershell.ps1
+++ b/tools/install-powershell.ps1
@@ -156,6 +156,19 @@ try {
Move-Item -Path $contentPath -Destination $Destination
}
+ # Edit icon to disambiguate daily builds.
+ if ($IsWinEnv -and $Daily.IsPresent) {
+ if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) {
+ Write-Verbose "Install RCEdit for modifying exe resources" -Verbose
+ $rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe"
+ New-Item -Path "~/.rcedit" -Type Directory -Force > $null
+ Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl
+ }
+
+ Write-Verbose "Change icon to disambiguate it from a released installation" -Verbose
+ & "~/.rcedit/rcedit-x64.exe" "$Destination\pwsh.exe" --set-icon "$Destination\assets\Powershell_av_colors.ico"
+ }
+
## Change the mode of 'pwsh' to 'rwxr-xr-x' to allow execution
if (-not $IsWinEnv) { chmod 755 $Destination/pwsh }
diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1
index 4ac1211527c..05cf70a59a4 100644
--- a/tools/packaging/packaging.psm1
+++ b/tools/packaging/packaging.psm1
@@ -448,6 +448,12 @@ function New-PSSignedBuildZip
Copy-Item -Path $_ -Destination $destination -force
}
+ # Remove `signed` folder in buildpath now that signed binaries are copied
+ if (Test-Path $BuildPath\signed)
+ {
+ Remove-Item -Recurse -Force -Path $BuildPath\signed
+ }
+
$name = split-path -Path $BuildPath -Leaf
$zipLocationPath = Join-Path -Path $DestinationFolder -ChildPath "$name-signed.zip"
Compress-Archive -Path $BuildPath\* -DestinationPath $zipLocationPath
diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile
index 883d4c34d0f..110d5bc4995 100644
--- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile
+++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile
@@ -1,11 +1,28 @@
# escape=`
#0.3.6 (no powershell 6)
-FROM travisez13/microsoft.windowsservercore.build-tools:latest
+FROM microsoft/windowsservercore
LABEL maintainer='PowerShell Team '
LABEL description="This Dockerfile for Windows Server Core with git installed via chocolatey."
-SHELL ["powershell"]
+SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
+# Install Git, and NuGet
+# Git installs to C:\Program Files\Git
+# nuget installs to C:\ProgramData\chocolatey\bin\NuGet.exe
+COPY dockerInstall.psm1 containerFiles/dockerInstall.psm1
+RUN Import-Module ./containerFiles/dockerInstall.psm1; `
+ Install-ChocolateyPackage -PackageName git -Executable git.exe; `
+ Install-ChocolateyPackage -PackageName nuget.commandline -Executable nuget.exe -Cleanup
+
+# Install WIX
+ADD https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip /wix.zip
+COPY wix.psm1 containerFiles/wix.psm1
+RUN Import-Module ./containerFiles/wix.psm1; `
+ Install-WixZip -zipPath \wix.Zip
COPY PowerShellPackage.ps1 /
-ENTRYPOINT ["powershell"]
+ADD https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 \install-powershell.ps1
+RUN new-item -Path 'C:\Program Files\PowerShell\latest' -ItemType Directory; `
+ \install-powershell.ps1 -AddToPath -Destination 'C:\Program Files\PowerShell\latest'
+
+ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\pwsh.exe", "-command"]
diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/dockerInstall.psm1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/dockerInstall.psm1
new file mode 100644
index 00000000000..3f54e2d6105
--- /dev/null
+++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/dockerInstall.psm1
@@ -0,0 +1,113 @@
+function Install-ChocolateyPackage
+{
+ param(
+ [Parameter(Mandatory=$true)]
+ [string]
+ $PackageName,
+
+ [Parameter(Mandatory=$false)]
+ [string]
+ $Executable,
+
+ [string[]]
+ $ArgumentList,
+
+ [switch]
+ $Cleanup,
+
+ [int]
+ $ExecutionTimeout = 2700,
+
+ [string]
+ $Version
+ )
+
+ if(-not(Get-Command -name Choco -ErrorAction SilentlyContinue))
+ {
+ Write-Verbose "Installing Chocolatey provider..." -Verbose
+ Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
+ }
+
+ Write-Verbose "Installing $PackageName..." -Verbose
+ $extraCommand = @()
+ if($Version)
+ {
+ $extraCommand += '--version', $version
+ }
+ choco install -y $PackageName --no-progress --execution-timeout=$ExecutionTimeout $ArgumentList $extraCommands
+
+ if($executable)
+ {
+ Write-Verbose "Verifing $Executable is in path..." -Verbose
+ $exeSource = $null
+ $exeSource = Get-ChildItem -path "$env:ProgramFiles\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
+ if(!$exeSource)
+ {
+ Write-Verbose "Falling back to x86 program files..." -Verbose
+ $exeSource = Get-ChildItem -path "${env:ProgramFiles(x86)}\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
+ }
+
+ # Don't search the chocolatey program data until more official locations have been searched
+ if(!$exeSource)
+ {
+ Write-Verbose "Falling back to chocolatey..." -Verbose
+ $exeSource = Get-ChildItem -path "$env:ProgramData\chocolatey\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
+ }
+
+ # all obvious locations are exhausted, use brute force and search from the root of the filesystem
+ if(!$exeSource)
+ {
+ Write-Verbose "Falling back to the root of the drive..." -Verbose
+ $exeSource = Get-ChildItem -path "/$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
+ }
+
+ if(!$exeSource)
+ {
+ throw "$Executable not found"
+ }
+
+ $exePath = Split-Path -Path $exeSource
+ Append-Path -path $exePath
+ }
+
+ if($Cleanup.IsPresent)
+ {
+ Remove-Folder -Folder "$env:temp\chocolatey"
+ }
+}
+
+function Append-Path
+{
+ param
+ (
+ $path
+ )
+ $machinePathString = [System.Environment]::GetEnvironmentVariable('path',[System.EnvironmentVariableTarget]::Machine)
+ $machinePath = $machinePathString -split ';'
+
+ if($machinePath -inotcontains $path)
+ {
+ $newPath = "$machinePathString;$path"
+ Write-Verbose "Adding $path to path..." -Verbose
+ [System.Environment]::SetEnvironmentVariable('path',$newPath,[System.EnvironmentVariableTarget]::Machine)
+ Write-Verbose "Added $path to path." -Verbose
+ }
+ else
+ {
+ Write-Verbose "$path already in path." -Verbose
+ }
+}
+
+function Remove-Folder
+{
+ param(
+ [string]
+ $Folder
+ )
+
+ Write-Verbose "Cleaning up $Folder..." -Verbose
+ $filter = Join-Path -Path $Folder -ChildPath *
+ [int]$measuredCleanupMB = (Get-ChildItem $filter -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB
+ Remove-Item -recurse -force $filter -ErrorAction SilentlyContinue
+ Write-Verbose "Cleaned up $measuredCleanupMB MB from $Folder" -Verbose
+}
diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1
new file mode 100644
index 00000000000..11da58df024
--- /dev/null
+++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1
@@ -0,0 +1,22 @@
+Import-Module "$PSScriptRoot\dockerInstall.psm1"
+
+# Install using Wix Zip because the MSI requires an older version of dotnet
+# which was large and unstable in docker
+function Install-WixZip
+{
+ param($zipPath)
+
+ $targetRoot = "${env:ProgramFiles(x86)}\WiX Toolset xcopy"
+ $binPath = Join-Path -Path $targetRoot -ChildPath 'bin'
+ Write-Verbose "Expanding $zipPath to $binPath ..." -Verbose
+ Expand-Archive -Path $zipPath -DestinationPath $binPath -Force
+ $docExpandPath = Join-Path -Path $binPath -ChildPath 'doc'
+ $sdkExpandPath = Join-Path -Path $binPath -ChildPath 'sdk'
+ $docTargetPath = Join-Path -Path $targetRoot -ChildPath 'doc'
+ $sdkTargetPath = Join-Path -Path $targetRoot -ChildPath 'sdk'
+ Write-Verbose "Fixing folder structure ..." -Verbose
+ Move-Item -Path $docExpandPath -Destination $docTargetPath
+ Move-Item -Path $sdkExpandPath -Destination $sdkTargetPath
+ Append-Path -path $binPath
+ Write-Verbose "Done installing WIX!"
+}
diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json
index c69471575df..7d118122a73 100644
--- a/tools/releaseBuild/build.json
+++ b/tools/releaseBuild/build.json
@@ -9,7 +9,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "release"
},
@@ -22,7 +26,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "release"
},
@@ -35,7 +43,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "symbols",
"BinariesExpected": 1,
@@ -50,7 +62,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "symbols",
"BinariesExpected": 1,
@@ -65,7 +81,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "signed",
"BinariesExpected": 2
@@ -79,7 +99,11 @@
"3968m"
],
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
- "AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1"],
+ "AdditionalContextFiles" :[
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
+ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
+ ],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "signed",
"BinariesExpected": 2
diff --git a/tools/releaseBuild/generatePackgeSigning.ps1 b/tools/releaseBuild/generatePackgeSigning.ps1
index b7177ed43b5..bb02231f2e8 100644
--- a/tools/releaseBuild/generatePackgeSigning.ps1
+++ b/tools/releaseBuild/generatePackgeSigning.ps1
@@ -42,11 +42,11 @@ function New-FileElement
if(Test-Path -Path $file)
{
$name = Split-Path -Leaf -Path $File
- $null = $fileElement = $XmlDoc.CreateElement("file")
+ $fileElement = $XmlDoc.CreateElement("file")
New-Attribute -Name 'src' -value $file -Element $fileElement
New-Attribute -Name 'signType' -value $SignType -Element $fileElement
New-Attribute -Name 'dest' -value "__OUTPATHROOT__\$name" -Element $fileElement
- $null = $job.AppendChild($fileElement)
+ $null = $job.AppendChild($fileElement)
}
else
{
@@ -69,4 +69,4 @@ foreach($file in $AuthenticodeFiles)
$signingXml.Save($path)
$updateScriptPath = Join-Path -Path $PSScriptRoot -ChildPath 'updateSigning.ps1'
-& $updateScriptPath -SigningXmlPath $path
\ No newline at end of file
+& $updateScriptPath -SigningXmlPath $path