make gem use sudo for macOS (#6610)
gem install requires sudo on official macOS build VMs. - make bootstrap use sudo for macOS
This commit is contained in:
parent
18e6a5c654
commit
aefc0d89b0
11
build.psm1
11
build.psm1
|
@ -1671,9 +1671,14 @@ function Start-PSBootstrap {
|
|||
# Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn)
|
||||
if ($Package) {
|
||||
try {
|
||||
# We cannot guess if the user wants to run gem install as root
|
||||
Start-NativeExecution { gem install fpm -v 1.9.3 }
|
||||
Start-NativeExecution { gem install ronn -v 0.7.3 }
|
||||
# We cannot guess if the user wants to run gem install as root on linux and windows,
|
||||
# but macOs usually requires sudo
|
||||
$gemsudo = ''
|
||||
if($Environment.IsMacOS) {
|
||||
$gemsudo = $sudo
|
||||
}
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.9.3"))
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ronn -v 0.7.3"))
|
||||
} catch {
|
||||
Write-Warning "Installation of fpm and ronn gems failed! Must resolve manually."
|
||||
}
|
||||
|
|
|
@ -61,13 +61,6 @@ try {
|
|||
|
||||
if ($BootStrap.IsPresent) {
|
||||
Start-PSBootstrap -Package
|
||||
|
||||
# The gem install is run by bootstrap without sudo and fails on macOS.
|
||||
# Run the commands with sudo, to resolve the issue
|
||||
Write-Verbose -Message "Installing fpm..." -Verbose
|
||||
Start-NativeExecution { sudo gem install fpm -v 1.8.1 }
|
||||
Write-Verbose -Message "Installing ronn..." -Verbose
|
||||
Start-NativeExecution { sudo gem install ronn }
|
||||
}
|
||||
|
||||
if ($Build.IsPresent) {
|
||||
|
|
Loading…
Reference in a new issue