2020
2121VERSION=" 1.1.2"
2222gitreposubpath=" PowerShell/PowerShell/master"
23- gitreposubpath=" darwinjs/PowerShell/feature/install-powershell.sh"
2423gitreposcriptroot=" https://raw.githubusercontent.com/$gitreposubpath /tools"
2524thisinstallerdistro=osx
2625repobased=true
27- gitscriptname=" installpsh-osx.psh "
26+ gitscriptname=" installpsh-osx.sh "
2827
2928echo " \n*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro "
3029echo " *** Current PowerShell Core Version: $currentpshversion "
4241lowercase (){
4342 echo " $1 " | tr [A-Z] [a-z]
4443}
44+
45+ OS=` lowercase \` uname\` `
46+
4547if [ " ${OS} " == " windowsnt" ]; then
4648 OS=windows
4749 DistroBasedOn=windows
@@ -114,55 +116,46 @@ echo "\n*** Installing PowerShell Core for $DistroBasedOn..."
114116
115117if ! hash brew 2> /dev/null; then
116118 echo " Homebrew is not found, installing..."
117- $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
119+ ruby -e " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) " < /dev/null 2> /dev/null
120+ else
121+ echo " Howebrew is already installed, skipping..."
118122fi
119123
120- if hash brew 2> /dev/null; then
124+ if ! hash brew 2> /dev/null; then
121125 echo " ERROR: brew did not install correctly, exiting..." >&2
122126 exit 3
123127fi
124128
125- if [[ ! -d $( brew --prefix openssl) ]]; then
126- echo " Installing OpenSSL..."
127- if ! $SUDO brew install openssl; then
128- echo " ERROR: OpenSSL failed to install! Crypto functions will not work..." >&2
129- fi
130- else
131- $SUDO brew upgrade openssl
132- fi
133-
134- if [[ ! -d $( brew --prefix curl) ]]; then
135- if ! $SUDO brew install curl --with-openssl; then
136- echo " ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2
137- fi
138- else
139- if ! $SUDO brew reinstall curl --with-openssl; then
140- echo " ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2
129+ # Suppress output, it's very noisy on travis-ci
130+ if [[ ! -d $( brew --prefix cask) ]]; then
131+ echo " Installing cask..."
132+ if ! brew tap caskroom/cask > /dev/null; then
133+ echo " ERROR: Cask failed to install! Cannot install powershell..." >&2
141134 fi
142135fi
143136
144- if [[ ! -d $( brew --prefix powershell) ]] ; then
145- if ! $SUDO brew install powershell ; then
146- echo " ERROR: powershell failed to install... " >&2
147- exit 1
137+ if ! hash powershell 2> /dev/null ; then
138+ echo " Installing PowerShell... "
139+ if ! brew cask install powershell; then
140+ echo " ERROR: PowerShell failed to install! Cannot install powershell... " >&2
148141 fi
149142else
150- $SUDO brew upgrade powershell
143+ echo " PowerShell is already installed, skipping... "
151144fi
152145
153146if [[ " '$* '" =~ includeide ]] ; then
154147 echo " \n*** Installing VS Code PowerShell IDE..."
155148 if [[ ! -d $( brew --prefix visual-studio-code) ]]; then
156- if ! $SUDO brew install visual-studio-code; then
149+ if ! brew install visual-studio-code; then
157150 echo " ERROR: Visual Studio Code failed to install..." >&2
158151 exit 1
159152 fi
160153 else
161- $SUDO brew upgrade visual-studio-code
154+ brew upgrade visual-studio-code
162155 fi
163156
164157 echo " \n*** Installing VS Code PowerShell Extension"
165- $SUDO code --install-extension ms-vscode.PowerShell
158+ code --install-extension ms-vscode.PowerShell
166159fi
167160
168161powershell -noprofile -c ' "Congratulations! PowerShell is installed at $PSHOME"'
182175if [[ " $repobased " == true ]] ; then
183176 echo " *** NOTE: Run your regular package manager update cycle to update PowerShell Core"
184177fi
185- echo " *** Install Complete"
178+ echo " *** Install Complete"
0 commit comments