Go to file
Andrew Schwartzmeyer b2e3a1e2e3 Add unit test for HasRegistrySupport()
The use of the function in RegistryProvider cannot be tested without a
mock of a PowerShell cmdlet context.
2015-07-06 12:46:38 -07:00
ext-src added cpp unit, simple bootstrap build script, added unit test to check a few coreclr pal datatypes 2015-02-12 17:04:28 -08:00
scripts cleaned Makefile, extended powershell-simple.exe host, updated to latest monad version 2015-07-01 11:23:53 -07:00
src Add unit test for HasRegistrySupport() 2015-07-06 12:46:38 -07:00
.gitignore bulk add of all build changes and resources needed to build PS on linux 2015-05-29 13:56:28 -07:00
.gitmodules Update src/monad submodule to monad-sync1 2015-06-26 11:36:48 -07:00
README.md Fix list items 2015-07-01 15:14:02 -07:00

PowerShell for Linux

Getting started

These instructions assume Ubuntu 14.04 LTS, the same as our dependency, CoreCLR. Fortunately you do not have to build CoreCLR, as we bundle the dependencies in submodules.

Installing dependencies

Setup the Mono package repository because Ubuntu's Mono packages are out of date.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update

Install necessary packages.

  • Git, the version control system
  • Mono, the C# compiler for Linux
  • Nuget, the C# package manager
  • libunwind8, used to determine the call-chain
  • GCC and G++, for compiling C and C++ native code
  • GNU Make, for building monad-linux
  • CMake, for building src/monad-native
  • Node.js, to run the Visual Studio Online mshttps Git remote helper
  • smbclient, to obtain mshttps
  • ntpdate, to update the system time
sudo apt-get install git mono-devel nuget libunwind8 gcc g++ make cmake nodejs nodejs-legacy smbclient ntpdate

Obtaining sources

The user name and email must be set to do just about anything with Git. The URL mapping (and mshttps itself) is needed for the two factor authentication that internal VSO imposes.

git config --global user.name "First Last"
git config --global user.email "alias@microsoft.com"
git config --global url.mshttps://msostc.visualstudio.com/.insteadof https://msostc.visualstudio.com/
git config --global url.mshttps://microsoft.visualstudio.com/.insteadof https://microsoft.visualstudio.com/

Install VSO's Git mshttps remote helper, and update the system time (necessary for authentication with VSO).

smbclient --user=domain\\username --directory=drops\\RemoteHelper.NodeJS\\latest \\\\gitdrop\\ProjectJ -c "get git-remote-mshttps.tar.gz"
sudo tar -xvf git-remote-mshttps.tar.gz -C /usr/local/bin
sudo chmod +x /usr/local/bin/git-remote-mshttps
sudo ntpdate time.nist.gov

If the file transfer fails with tree connect failed: NT_STATUS_DUPLICATE_NAME, use nslookup gitdrop to obtain its canonical name (currently osgbldarcfs02.redmond.corp.microsoft.com) and use it instead.

Clone our monad-linux source from Visual Studio Online. We use the develop branch, and several submodules, necessitating the arguments.

git clone -b develop --recursive https://msostc.visualstudio.com/DefaultCollection/PS/_git/monad-linux

Building

  1. cd scripts since it contains the Makefile
  2. make prepare will use Nuget to download several dependencies
  3. make all will build PowerShell for Linux
  4. make run will execute a demo, "a","b","c","a","a" | Select-Object -Unique
  5. make run-interactive will open an interactive PowerShell console
  6. make test will execute the unit tests
  7. make clean will remove the built objects
  8. make cleanall will also remove the Nuget packages

TODO: Unit tests

TODO: Docker setup

TODO: Architecture