From fb43e8ee962bf0d1efe993b42e6f22c9a5d37f54 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Tue, 22 Aug 2017 13:38:28 +0300 Subject: [PATCH 1/2] Add option to skip the questions during setup --- setup/native-script.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup/native-script.ps1 b/setup/native-script.ps1 index 1543c6924f..6cec82fc39 100644 --- a/setup/native-script.ps1 +++ b/setup/native-script.ps1 @@ -5,7 +5,9 @@ # @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))" # To run it inside a WINDOWS POWERSHELL console against the production branch (only one supported with self-elevation) use # start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))" - +param( + [switch] $SilentMode +) # Check if latest .NET framework installed is at least 4 $dotNetVersions = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version,Release -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select Version $latestDotNetVersion = $dotNetVersions.GetEnumerator() | Sort-Object Version | Select-Object -Last 1 @@ -27,7 +29,7 @@ if (-not $isElevated) { } # Help with installing other dependencies -$script:answer = "" +$script:answer = $SilentMode function Install($programName, $message, $script, $shouldExit) { if ($script:answer -ne "a") { Write-Host -ForegroundColor Green "Allow the script to install $($programName)?" From a08f3d85ec2c6a8de8ebfc8835ba08c03a1a14c1 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Wed, 23 Aug 2017 13:48:17 +0300 Subject: [PATCH 2/2] Initialize correctly the answer variable --- setup/native-script.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/native-script.ps1 b/setup/native-script.ps1 index 6cec82fc39..20f4d6260a 100644 --- a/setup/native-script.ps1 +++ b/setup/native-script.ps1 @@ -29,7 +29,7 @@ if (-not $isElevated) { } # Help with installing other dependencies -$script:answer = $SilentMode +$script:answer = if ($SilentMode) {"a"} else {""} function Install($programName, $message, $script, $shouldExit) { if ($script:answer -ne "a") { Write-Host -ForegroundColor Green "Allow the script to install $($programName)?"