Skip to content

Commit

Permalink
tools,win: refactor install_tools.bat
Browse files Browse the repository at this point in the history
* Ask for credentials upfront
* Try to `-DisableReboots`
  • Loading branch information
refack committed Nov 5, 2018
1 parent 765766b commit 090643f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/msvs/install_tools/install_tools.bat
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ if /i not "%ACCEPT_PROMPT%"=="yes" (
goto acceptretry
)

"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command iex ((New-Object System.Net.WebClient).DownloadString(''https://boxstarter.org/bootstrapper.ps1'')); get-boxstarter -Force; Install-BoxstarterPackage -PackageName ''%~dp0\install_tools.txt''; Read-Host ''Type ENTER to exit'' ' -Verb RunAs
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -File "%~dp0\install_tools.ps1"' -Verb RunAs
23 changes: 23 additions & 0 deletions tools/msvs/install_tools/install_tools.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
try
{
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent;

# Ask for an opaque user credentials token
$cred = Get-Credential $( whoami ) -Message "The Node.js installer needs your credentials to streamline the installation of the Build Tools";
if (!($cred)) {
# Wait for user confirmation.
Echo 'The installer will now exit.';
Read-Host 'Press ENTER to finish';
exit 1;
}
# The following line is lifted verbatim from https://boxstarter.org/InstallBoxstarter
iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force;

# Install the packges from `install_tools.txt`
Install-BoxstarterPackage -PackageName ($PSScriptRoot+'\install_tools.txt') -Credential $cred -DisableReboots;

# Wait for user confirmation.
Read-Host 'Press ENTER to finish';
} catch {
exit 1;
}

0 comments on commit 090643f

Please sign in to comment.