8000 make gem use sudo for macOS (#6610) · PowerShell/PowerShell@aefc0d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit aefc0d8

Browse files
authored
make gem use sudo for macOS (#6610)
gem install requires sudo on official macOS build VMs. - make bootstrap use sudo for macOS
1 parent 18e6a5c commit aefc0d8

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

build.psm1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,9 +1671,14 @@ function Start-PSBootstrap {
16711671
# Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn)
16721672
if ($Package) {
16731673
try {
1674-
# We cannot guess if the user wants to run gem install as root
1675-
Start-NativeExecution { gem install fpm -v 1.9.3 }
1676-
Start-NativeExecution { gem install ronn -v 0.7.3 }
1674+
# We cannot guess if the user wants to run gem install as root on linux and windows,
1675+
# but macOs usually requires sudo
1676+
$gemsudo = ''
1677+
if($Environment.IsMacOS) {
1678+
$gemsudo = $sudo
1679+
}
1680+
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.9.3"))
1681+
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ronn -v 0.7.3"))
16771682
} catch {
16781683
Write-Warning "Installation of fpm and ronn gems failed! Must resolve manually."
16791684
}

tools/releaseBuild/macOS/PowerShellPackageVsts.ps1

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ try {
6161

6262
if ($BootStrap.IsPresent) {
6363
Start-PSBootstrap -Package
64-
65-
# The gem install is run by bootstrap without sudo and fails on macOS.
66-
# Run the commands with sudo, to resolve the issue
67-
Write-Verbose -Message "Installing fpm..." -Verbose
68-
Start-NativeExecution { sudo gem install fpm -v 1.8.1 }
69-
Write-Verbose -Message "Installing ronn..." -Verbose
70-
Start-NativeExecution { sudo gem install ronn }
7164
}
7265

7366
if ($Build.IsPresent) {

0 commit comments

Comments
 (0)
0