PowerShell/tools/install-powershell-readme.md
Bram Crielaard 7031954669 Make install scripts more consistent over different operating systems (#9071)
I noticed a couple of inconsistencies when reading through the install bash scripts. 

- Make documentation for switches consistent over all files.
- Replace all `sed` implementations of `lowercase` with a more maintainable `tr` implementation.
- Set the `OS` variable in every install script, making it so previously unused checks are actually used.
- Exit with a non-zero exit code when the script reaches an illegal state.


## PR Context

A lot of people, including myself, read the install scripts before executing them. While doing so I noticed they contained inconsistencies. For example, certain flags you can pass to the install script were either undocumented or had an incorrect description. This PR fixes some of these inconsistencies, which should make them easier to maintain and easier to read.

Co-authored-by: Travis Plunk <github@ez13.net>
2019-03-08 13:00:04 -08:00

2.5 KiB

install-powershell.sh

Features of install-powershell.sh

  • can be called directly from git
  • optionally installs vs code and vs powershell extension (aka PowerShell IDE) using optional -includeide switch
  • defaults to completely automated operation (if appropriate permissions are available)
  • automatically looks up latest version via git tags
  • automatic selection of appropriate install sub-script
  • configures software installs for repositories when repositories are in place, otherwise pulls files from git releases. As repository versions are made available, script will be updated to take advantage.
  • user permission checking
  • sub-installers called from local file system if they exist, otherwise pulled from git
  • sub-installers can be called directly if auto-selection is not needed

Minimum Requirements for install-powershell.sh

  • bash shell
  • sed
  • native package manager available
  • curl (auto-installed if missing)

Parameters

  • -includeide - installs VSCode and VSCode PowerShell extension (only relevant to machines with a desktop environment)
  • -interactivetesting - do a quick launch test of VSCode (only relevant when used with -includeide)
  • -skip-sudo-check - use sudo without verifying its availability (hard to accurately do on some distros)
  • -preview - installs the latest preview release of PowerShell core side-by-side with any existing production releases
  • -appimage - perform an AppImage install instead of a native install

Usage

Direct from Github

bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) <ARGUMENTS>

wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh | bash -s <ARGUMENTS>

Local Copy

bash install-powershell.sh <ARGUMENTS>

Examples

Only Install PowerShell Core

bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh)

Install PowerShell Core with IDE

bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) -includeide

Install PowerShell Core with IDE and do tests that require a human to interact with the installation process

bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) -includeide -interactivetesting

Installation To do list

  • Detect and wait when package manager is busy/locked? - at least Ubuntu (CentOS does this internally)