Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ function Start-PSBuild {
# This is allowed to fail since the user may have already restored
Write-Warning ".NET Core links the incorrect OpenSSL, correcting NuGet package libraries..."
find $env:HOME/.nuget -name System.Security.Cryptography.Native.dylib | xargs sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib
find $env:HOME/.nuget -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib
}
}

Expand Down Expand Up @@ -820,13 +821,16 @@ function Start-PSBootstrap {
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/"

# Build tools
$Deps += "curl", "cmake"
$Deps += "cmake"

# .NET Core required runtime libraries
$Deps += "openssl"

# Install dependencies
Start-NativeExecution { brew install $Deps }

# Install patched version of curl
Start-NativeExecution { brew install curl --with-openssl }
}

# Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn)
Expand Down Expand Up @@ -1194,17 +1198,40 @@ esac
chmod 755 "$Staging/$Name" # only the executable should be executable
}

$libunwind = switch ($Type) {
"deb" { "libunwind8" }
"rpm" { "libunwind" }
}

$libicu = switch ($Type) {
"deb" {
if ($IsUbuntu14) { "libicu52" }
elseif ($IsUbuntu16) { "libicu55" }
}
"rpm" { "libicu" }
# Setup package dependencies
# These should match those in the Dockerfiles, but exclude tools like Git, which, and curl
$Dependencies = @()
if ($IsUbuntu) {
$Dependencies = @(
"libc6",
"libcurl3",
"libgcc1",
"libssl1.0.0",
"libstdc++6",
"libtinfo5",
"libunwind8",
"libuuid1",
"zlib1g"
)
# Please note the different libicu package dependency!
if ($IsUbuntu14) {
$Dependencies += "libicu52"
} elseif ($IsUbuntu16) {
$Dependencies += "libicu55"
}
} elseif ($IsCentOS) {
$Dependencies = @(
"glibc",
"libcurl",
"libgcc",
"libicu",
"openssl",
"libstdc++",
"ncurses-base",
"libunwind",
"uuid",
"zlib"
)
}

# iteration is "debian_revision"
Expand Down Expand Up @@ -1232,11 +1259,12 @@ esac
"--description", $Description,
"--category", "shells",
"--rpm-os", "linux",
"--depends", $libunwind,
"--depends", $libicu,
"-t", $Type,
"-s", "dir"
)
foreach ($Dependency in $Dependencies) {
$Arguments += @("--depends", $Dependency)
}
if ($AfterInstallScript) {
$Arguments += @("--after-install", $AfterInstallScript)
}
Expand Down
59 changes: 40 additions & 19 deletions docs/installation/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ Supports [Ubuntu 14.04][u14], [Ubuntu 16.04][u16],
[CentOS 7][cos], and [macOS 10.11][osx].
All packages are available on our GitHub [releases][] page.

All of these steps can be down automatically by the [`download.sh`][download] script.
You should *never* run a script without reading it first!

Please **read the [download][] script first**, and then if you want to run it, use:

```sh
bash <(curl -fsSL https://raw.githubusercontent.com/PowerShell/PowerShell/v6.0.0-alpha.10/tools/download.sh)
```

Once the package is installed, run `powershell` from a terminal.

[u14]: #ubuntu-1404
[u16]: #ubuntu-1604
[cos]: #centos-7
[osx]: #os-x-1011
[paths]:#paths
[download]: https://github.com/PowerShell/PowerShell/blob/v6.0.0-alpha.10/tools/download.sh

Ubuntu 14.04
============
Expand All @@ -23,16 +32,19 @@ from the [releases][] page onto the Ubuntu machine.
Then execute the following in the terminal:

```sh
sudo apt-get install libunwind8 libicu52
sudo dpkg -i powershell_6.0.0-alpha.10-1ubuntu1.14.04.1_amd64.deb
sudo apt-get install -f
```
**Uninstallation**

`sudo apt-get remove powershell`
> Please note that `dpkg -i` will fail with unmet dependencies;
> the next command, `apt-get install -f` resolves these
> and then finishes configuring the PowerShell package.

or
**Uninstallation**

`sudo dpkg -r powershell`
```sh
sudo apt-get remove powershell
```

[Ubuntu 14.04]: http://releases.ubuntu.com/14.04/

Expand All @@ -45,19 +57,20 @@ from the [releases][] page onto the Ubuntu machine.

Then execute the following in the terminal:

> Please note the different libicu package dependency!

```sh
sudo apt-get install libunwind8 libicu55
sudo dpkg -i powershell_6.0.0-alpha.10-1ubuntu1.16.04.1_amd64.deb
sudo apt-get install -f
```
**Uninstallation**

`sudo apt-get remove powershell`
> Please note that `dpkg -i` will fail with unmet dependencies;
> the next command, `apt-get install -f` resolves these
> and then finishes configuring the PowerShell package.

or
**Uninstallation**

`sudo dpkg -r powershell`
```sh
sudo apt-get remove powershell
```

[Ubuntu 16.04]: http://releases.ubuntu.com/16.04/

Expand All @@ -73,13 +86,11 @@ from the [releases][] page onto the CentOS machine.
Then execute the following in the terminal:

```sh
sudo yum install powershell-6.0.0_alpha.10-1.el7.centos.x86_64.rpm
sudo yum install ./powershell-6.0.0_alpha.10-1.el7.centos.x86_64.rpm
```

You can also install the RPM without the intermediate step of downloading it:



```sh
sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.10/powershell-6.0.0_alpha.10-1.el7.centos.x86_64.rpm
```
Expand All @@ -88,7 +99,9 @@ sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0

**Uninstallation**

`sudo yum remove powershell`
```sh
sudo yum remove powershell
```

[CentOS 7]: https://www.centos.org/download/

Expand All @@ -111,10 +124,16 @@ sudo installer -pkg powershell-6.0.0-alpha.10.pkg -target /
PowerShell on MacOS must be removed manually.

To remove the installed package:

```sh
sudo rm -rf /usr/local/bin/powershell usr/local/microsoft/powershell
sudo rm -rf /usr/local/bin/powershell /usr/local/microsoft/powershell
```
To uninstall the additional PowerShell paths (such as the user profile path) please see the [paths][paths] section below in this document and remove the desired the paths with `sudo rm`.

To uninstall the additional PowerShell paths (such as the user profile path)
please see the [paths][paths] section below in this document
and remove the desired the paths with `sudo rm`.

[paths]:#paths

OpenSSL
-------
Expand All @@ -123,6 +142,7 @@ Also install [Homebrew's OpenSSL][openssl]:

```
brew install openssl
brew install curl --with-openssl
```

[Homebrew][brew] is the missing package manager for macOS.
Expand All @@ -148,6 +168,7 @@ To patch .NET Core's cryptography libraries, we use `install_name_tool`:

```
find ~/.nuget -name System.Security.Cryptography.Native.dylib | xargs sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib
find ~/.nuget -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib
```

This updates .NET Core's library to look in Homebrew's OpenSSL installation location instead of the system library location.
Expand Down
31 changes: 18 additions & 13 deletions tools/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,49 @@ case "$OSTYPE" in
linux*)
source /etc/os-release
# Install dependencies
echo "Installing PowerShell with sudo..."
case "$ID" in
centos)
echo "Installing libicu, libunwind, and $package with sudo ..."
sudo yum install -y libicu libunwind
# yum automatically resolves dependencies for local packages
sudo yum install "./$package"
;;
ubuntu)
case "$VERSION_ID" in
14.04)
icupackage=libicu52
;;
16.04)
icupackage=libicu55
;;
esac
echo "Installing $libicupackage, libunwind8, and $package with sudo ..."
sudo apt-get install -y libunwind8 "$icupackage"
sudo dpkg -i "./$package"
# dpkg does not automatically resolve dependencies, but spouts ugly errors
sudo dpkg -i "./$package" &> /dev/null
# Resolve dependencies
sudo apt-get install -f
;;
*)
esac
;;
darwin*)
patched=0
if hash brew 2>/dev/null; then
if [[ ! -d $(brew --prefix openssl) ]]; then
echo "Installing OpenSSL with brew..."
if ! brew install openssl; then
echo "ERROR: OpenSSL failed to install! Crypto functions will not work..." >&2
# Don't abort because it is not fatal
elif ! brew install curl --with-openssl; then
echo "ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2
# Still not fatal
else
# OpenSSL installation succeeded; remember to patch System.Net.Http after PowerShell installation
patched=1
fi
fi

else
echo "ERROR: brew not found! OpenSSL may not be available..." >&2
# Don't abort because it is not fatal
fi

echo "Installing $package with sudo ..."
sudo installer -pkg "./$package" -target /
if [[ $patched -eq 1 ]]; then
echo "Patching System.Net.Http for libcurl and OpenSSL..."
find /usr/local/microsoft/powershell -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib
fi
;;
esac

Expand Down