Add -NoSudo option to Start-PSBootstrap

This commit is contained in:
Andrew Schwartzmeyer committed 2016-09-12 15:01:18 -07:00
1 parent 3687692802
commit 3a66c04f23
1 file changed
+9 -2
+9 -2
View File
@@ -688,6 +688,7 @@ function Start-PSBootstrap {
[string]$Channel = "rel-1.0.0", [string]$Channel = "rel-1.0.0",
[string]$Version = "latest", [string]$Version = "latest",
[switch]$Package, [switch]$Package,
[switch]$NoSudo,
[switch]$Force [switch]$Force
) )
@@ -695,6 +696,10 @@ function Start-PSBootstrap {
Push-Location $PSScriptRoot/tools Push-Location $PSScriptRoot/tools
# This allows sudo install to be optional; needed when running in containers / as root
# Note that when it is null, Invoke-Expression (but not &) must be used to interpolate properly
$sudo = if (!$NoSudo) { "sudo" }
try { try {
# Update googletest submodule for linux native cmake # Update googletest submodule for linux native cmake
if ($IsLinux -or $IsOSX) { if ($IsLinux -or $IsOSX) {
@@ -723,7 +728,7 @@ function Start-PSBootstrap {
if ($Package) { $Deps += "ruby-dev", "groff" } if ($Package) { $Deps += "ruby-dev", "groff" }
# Install dependencies # Install dependencies
sudo apt-get install -y -qq $Deps Start-NativeExecution { Invoke-Expression "$sudo apt-get install -y -qq $Deps" }
} elseif ($IsCentOS) { } elseif ($IsCentOS) {
# Build tools # Build tools
$Deps += "which", "curl", "gcc-c++", "cmake", "make" $Deps += "which", "curl", "gcc-c++", "cmake", "make"
@@ -735,7 +740,9 @@ function Start-PSBootstrap {
if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff" } if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff" }
# Install dependencies # Install dependencies
sudo yum install -y -q $Deps Start-NativeExecution {
Invoke-Expression "$sudo yum install -y -q $Deps"
}
} elseif ($IsOSX) { } elseif ($IsOSX) {
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/" precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/"