Merge pull request #1855 from raghushantha/master

Consolidate demos/install/install.sh with tools/install/download.sh, add README
This commit is contained in:
Andy Schwartzmeyer
2016-08-18 00:12:04 -07:00
committed by GitHub
5 changed files with 14 additions and 104 deletions
+5
View File
@@ -0,0 +1,5 @@
## Install demo
For Windows refer to the [installation instructions](https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md)
For Linux, using [download.sh](https://github.com/PowerShell/PowerShell/blob/master/tools/download.sh) is the best way to deploy PowerShell bits
-1
View File
@@ -1 +0,0 @@
Placeholder for Windows install script
-102
View File
@@ -1,102 +0,0 @@
#!/usr/bin/env bash
clear
echo "Script to download latest release of PowerShell on *nix platforms"
echo "Verify if GITHUB_TOKEN variable is defined"
[[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, Generate one using https://help.github.com/articles/creating-an-access-token-for-command-line-use/"; exit 1; }
# Authorizes with read-only access to GitHub API
curl_() {
curl -s -i -H "Authorization: token $GITHUB_TOKEN" "$@"
}
# Retrieves asset ID and package name of asset ending in argument
# $info looks like: "id": 1698239, "name": "powershell_0.4.0-1_amd64.deb",
get_info() {
curl_ https://api.github.com/repos/PowerShell/PowerShell/releases/latest | grep -B 1 "name.*$1"
}
echo "Get OS specific asset ID and package name"
case "$OSTYPE" in
linux*)
source /etc/os-release
echo $ID
# Install curl and wget to download package
case "$ID" in
centos*)
sudo yum install -y curl wget
info=$(get_info rpm)
;;
ubuntu)
sudo apt-get install -y curl wget
info=$(get_info deb)
;;
*)
exit 2 >&2 "Package $NAME is not supported on $OSTYPE!"
esac
;;
darwin*)
info=$(get_info pkg)
;;
*)
exit 2 >&2 "$OSTYPE is not supported!"
;;
esac
# Parses $info for asset ID and package name
read asset package <<< $(echo $info | sed 's/[,"]//g' | awk '{ print $2; print $4 }')
# Downloads asset to file
curl_ -H 'Accept: application/octet-stream' https://api.github.com/repos/PowerShell/PowerShell/releases/assets/$asset |
grep location | sed 's/location: //g' | wget -i - -O $package
# Installs PowerShell package
case "$OSTYPE" in
linux*)
source /etc/os-release
# Install dependencies
case "$ID" in
centos)
sudo yum install -y libicu libunwind
sudo yum install "./$package"
;;
ubuntu)
sudo apt-get install -y libunwind8 libicu52
sudo dpkg -i "./$package"
;;
*)
esac
;;
darwin*)
sudo installer -pkg ./$package -target /
;;
esac
get_smadll_location() {
dpkg-query --listfiles PowerShell | grep "System.Management.Automation.dll"
}
get_powershell_location() {
dirname $(get_smadll_location)
}
get_powershell_symlink() {
dir /usr/bin/powershell
}
install_location=$(get_powershell_location)
powershell_symlink=$(get_powershell_symlink)
if [ $install_location ]
then
echo "Congratulations! PowerShell \"$package\" is installed @ \"$install_location\""
fi
if [ $powershell_symlink ]
then
echo "Symlink is available @ \"$powershell_symlink\""
else
echo "PowerShell install failed! Check this script's output for information"
exit -1
fi
+3
View File
@@ -13,6 +13,9 @@ There is a shortcut placed in the Start Menu upon installation.
>
> You can launch PowerShell via the Start Menu or `$env:ProgramFiles\PowerShell\powershell.exe`
> Note: On Windows 8.1 / Windows 2012R2, ensure Visual C++ Redistributable
> for VS2015 is installed from [here](http://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe):
# Instructions to Create a Remoting Endpoint
Beginning with 6.0.0-alpha.9, the PowerShell package for Windows includes a WinRM plugin (pwrshplugin.dll) and an installation script (Install-PowerShellRemoting.ps1).
+6 -1
View File
@@ -88,4 +88,9 @@ case "$OSTYPE" in
;;
esac
echo "Congratulations! PowerShell is now installed."
powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
if [[ $? != 0 ]]; then
echo "ERROR! PowerShell didn't install. Check script output"
exit 1
fi