From e4dc9387320ec0107f3efecb25f2cdadebcdadbe Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 21 Jul 2017 14:20:51 -0700 Subject: [PATCH] Get macOS working and fix misc issue --- .spelling | 7 ++++ .travis.yml | 2 +- test/common/markdown/markdown.tests.ps1 | 1 + tools/install-powershell-readme.md | 8 ++-- tools/install-powershell.sh | 8 ++-- tools/installpsh-debian.sh | 3 +- tools/installpsh-osx.sh | 51 +++++++++++-------------- tools/installpsh-redhat.sh | 3 +- tools/installpsh-suse.sh | 3 +- 9 files changed, 43 insertions(+), 43 deletions(-) mode change 100644 => 100755 tools/install-powershell.sh mode change 100644 => 100755 tools/installpsh-debian.sh mode change 100644 => 100755 tools/installpsh-osx.sh mode change 100644 => 100755 tools/installpsh-redhat.sh mode change 100644 => 100755 tools/installpsh-suse.sh diff --git a/.spelling b/.spelling index 0b8d95d148..7394542225 100644 --- a/.spelling +++ b/.spelling @@ -889,6 +889,10 @@ WebRequest win7-x86 WindowsVersion XPath +alpha.18 +behavioral +MiaRomero +TheFlyingCorpse Youtube - test/tools/CodeCoverageAutomation/README.md CodeCoverage.zip @@ -914,3 +918,6 @@ post-6 - CODE_OF_CONDUCT.md opencode microsoft.com + - ./tools/install-powershell.readme.md +includeide +sed diff --git a/.travis.yml b/.travis.yml index 1747a4fa5a..6bd3fd23fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ addons: install: - pushd tools - - ./download.sh + - ./install-powershell.sh - popd # Default 2.0.0 Ruby is buggy # Default bundler version is buggy diff --git a/test/common/markdown/markdown.tests.ps1 b/test/common/markdown/markdown.tests.ps1 index bc32c1017e..51d99cd88c 100644 --- a/test/common/markdown/markdown.tests.ps1 +++ b/test/common/markdown/markdown.tests.ps1 @@ -78,6 +78,7 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' { './docs/maintainers/README.md' './demos/SSHRemoting/*.md' './docker/*.md' + './tools/*.md' ) $filter = ($docsToTest -join ',') &"gulp" test-mdsyntax --silent ` diff --git a/tools/install-powershell-readme.md b/tools/install-powershell-readme.md index d77c9a3378..08c7bddfda 100644 --- a/tools/install-powershell-readme.md +++ b/tools/install-powershell-readme.md @@ -37,25 +37,25 @@ bash install-powershell.sh ## Examples -### Only Install PowerShell Core: +### Only Install PowerShell Core ```bash bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) ``` -### Install PowerShell Core with IDE: +### Install PowerShell Core with IDE ```bash 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 install process: +### Install PowerShell Core with IDE and do tests that require a human to interact with the installation process ```bash bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) -includeide -interactivetesting ``` -### Install AppImage: +### Install AppImage ```bash bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) -appimage diff --git a/tools/install-powershell.sh b/tools/install-powershell.sh old mode 100644 new mode 100755 index 90f3b2e4cf..2df3d60574 --- a/tools/install-powershell.sh +++ b/tools/install-powershell.sh @@ -23,7 +23,6 @@ VERSION="1.1.0" gitreposubpath="PowerShell/PowerShell/master" -gitreposubpath="darwinjs/PowerShell/feature/install-powershell.sh" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" gitscriptname="install-powershell.psh" @@ -52,10 +51,14 @@ MACH=`uname -m` if [ "${OS}" == "windowsnt" ]; then OS=windows DistroBasedOn=windows + SCRIPTFOLDER=$(dirname $(readlink -f $0)) elif [ "${OS}" == "darwin" ]; then OS=osx DistroBasedOn=osx + # readlink doesn't work the same on macOS + SCRIPTFOLDER=$(dirname $0) else + SCRIPTFOLDER=$(dirname $(readlink -f $0)) OS=`uname` if [ "${OS}" == "SunOS" ] ; then OS=solaris @@ -110,7 +113,7 @@ echo " REV: $REV" echo " KERNEL: $KERNEL" echo " MACH: $MACH" -SCRIPTFOLDER=$(dirname $(readlink -f $0)) + if [[ "'$*'" =~ appimage ]] ; then if [ -f $SCRIPTFOLDER/appimage.sh ]; then @@ -136,4 +139,3 @@ elif [ "$DistroBasedOn" == "redhat" ] || [ "$DistroBasedOn" == "debian" ] || [ " else echo "Sorry, your operating system is based on $DistroBasedOn and is not supported by PowerShell Core or this installer at this time." fi - diff --git a/tools/installpsh-debian.sh b/tools/installpsh-debian.sh old mode 100644 new mode 100755 index 17738f203b..acec6402b9 --- a/tools/installpsh-debian.sh +++ b/tools/installpsh-debian.sh @@ -20,7 +20,6 @@ VERSION="1.1.2" gitreposubpath="PowerShell/PowerShell/master" -gitreposubpath="darwinjs/PowerShell/feature/install-powershell.sh" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" thisinstallerdistro=debian repobased=true @@ -166,4 +165,4 @@ if [[ "$repobased" == true ]] ; then echo echo "*** NOTE: Run your regular package manager update cycle to update PowerShell Core\n" fi -echo "*** Install Complete" \ No newline at end of file +echo "*** Install Complete" diff --git a/tools/installpsh-osx.sh b/tools/installpsh-osx.sh old mode 100644 new mode 100755 index c8039129d6..48595bba91 --- a/tools/installpsh-osx.sh +++ b/tools/installpsh-osx.sh @@ -20,11 +20,10 @@ VERSION="1.1.2" gitreposubpath="PowerShell/PowerShell/master" -gitreposubpath="darwinjs/PowerShell/feature/install-powershell.sh" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" thisinstallerdistro=osx repobased=true -gitscriptname="installpsh-osx.psh" +gitscriptname="installpsh-osx.sh" echo "\n*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro" echo "*** Current PowerShell Core Version: $currentpshversion" @@ -42,6 +41,9 @@ trap ' lowercase(){ echo "$1" | tr [A-Z] [a-z] } + +OS=`lowercase \`uname\`` + if [ "${OS}" == "windowsnt" ]; then OS=windows DistroBasedOn=windows @@ -114,55 +116,46 @@ echo "\n*** Installing PowerShell Core for $DistroBasedOn..." if ! hash brew 2>/dev/null; then echo "Homebrew is not found, installing..." - $SUDO ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null +else + echo "Howebrew is already installed, skipping..." fi -if hash brew 2>/dev/null; then +if ! hash brew 2>/dev/null; then echo "ERROR: brew did not install correctly, exiting..." >&2 exit 3 fi -if [[ ! -d $(brew --prefix openssl) ]]; then - echo "Installing OpenSSL..." - if ! $SUDO brew install openssl; then - echo "ERROR: OpenSSL failed to install! Crypto functions will not work..." >&2 - fi -else - $SUDO brew upgrade openssl -fi - -if [[ ! -d $(brew --prefix curl) ]]; then - if ! $SUDO brew install curl --with-openssl; then - echo "ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2 - fi -else - if ! $SUDO brew reinstall curl --with-openssl; then - echo "ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2 +# Suppress output, it's very noisy on travis-ci +if [[ ! -d $(brew --prefix cask) ]]; then + echo "Installing cask..." + if ! brew tap caskroom/cask >/dev/null; then + echo "ERROR: Cask failed to install! Cannot install powershell..." >&2 fi fi -if [[ ! -d $(brew --prefix powershell) ]]; then - if ! $SUDO brew install powershell; then - echo "ERROR: powershell failed to install..." >&2 - exit 1 +if ! hash powershell 2>/dev/null; then + echo "Installing PowerShell..." + if ! brew cask install powershell; then + echo "ERROR: PowerShell failed to install! Cannot install powershell..." >&2 fi else - $SUDO brew upgrade powershell + echo "PowerShell is already installed, skipping..." fi if [[ "'$*'" =~ includeide ]] ; then echo "\n*** Installing VS Code PowerShell IDE..." if [[ ! -d $(brew --prefix visual-studio-code) ]]; then - if ! $SUDO brew install visual-studio-code; then + if ! brew install visual-studio-code; then echo "ERROR: Visual Studio Code failed to install..." >&2 exit 1 fi else - $SUDO brew upgrade visual-studio-code + brew upgrade visual-studio-code fi echo "\n*** Installing VS Code PowerShell Extension" - $SUDO code --install-extension ms-vscode.PowerShell + code --install-extension ms-vscode.PowerShell fi powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"' @@ -182,4 +175,4 @@ fi if [[ "$repobased" == true ]] ; then echo "*** NOTE: Run your regular package manager update cycle to update PowerShell Core" fi -echo "*** Install Complete" \ No newline at end of file +echo "*** Install Complete" diff --git a/tools/installpsh-redhat.sh b/tools/installpsh-redhat.sh old mode 100644 new mode 100755 index d0ab19cf47..861031b817 --- a/tools/installpsh-redhat.sh +++ b/tools/installpsh-redhat.sh @@ -20,7 +20,6 @@ VERSION="1.1.2" gitreposubpath="PowerShell/PowerShell/master" -gitreposubpath="darwinjs/PowerShell/feature/install-powershell.sh" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" thisinstallerdistro=redhat repobased=true @@ -159,4 +158,4 @@ fi if [[ "$repobased" == true ]] ; then echo "*** NOTE: Run your regular package manager update cycle to update PowerShell Core" fi -echo "*** Install Complete" \ No newline at end of file +echo "*** Install Complete" diff --git a/tools/installpsh-suse.sh b/tools/installpsh-suse.sh old mode 100644 new mode 100755 index c0c55d198a..067dea491b --- a/tools/installpsh-suse.sh +++ b/tools/installpsh-suse.sh @@ -20,7 +20,6 @@ VERSION="1.1.2" gitreposubpath="PowerShell/PowerShell/master" -gitreposubpath="darwinjs/PowerShell/feature/install-powershell.sh" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" thisinstallerdistro=suse repobased=true @@ -189,4 +188,4 @@ fi if [[ "$repobased" == true ]] ; then echo "*** NOTE: Run your regular package manager update cycle to update PowerShell Core" fi -echo "*** Install Complete" \ No newline at end of file +echo "*** Install Complete"