From 78a2ddadf9cd40894945729c87808821f58a10d7 Mon Sep 17 00:00:00 2001 From: Jackie Cheung Date: Mon, 2 Oct 2017 12:34:24 -0700 Subject: [PATCH] Adding git clone for the EventUI and renaming the script name --- installPrereqs.ps1 => installEventUI.ps1 | 37 ++++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) rename installPrereqs.ps1 => installEventUI.ps1 (80%) diff --git a/installPrereqs.ps1 b/installEventUI.ps1 similarity index 80% rename from installPrereqs.ps1 rename to installEventUI.ps1 index 4783e38..db7b36c 100644 --- a/installPrereqs.ps1 +++ b/installEventUI.ps1 @@ -1,7 +1,11 @@ +# installing rerequisites and cloning repos for SIA-EventUI + +# all bits are x64 version unless specified $nodejsUrl = "https://nodejs.org/dist/v6.11.3/node-v6.11.3-x64.msi" $dotnetCoreSDKUrl = "https://download.microsoft.com/download/0/F/D/0FD852A4-7EA1-4E2A-983A-0484AC19B92C/dotnet-sdk-2.0.0-win-x64.exe" $dotnetCoreRuntimeUrl = "https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x64.exe" +# registry key check to see if rerequisites are already installed $nodejsRegKeyCheck = Get-ItemProperty 'HKLM:\SOFTWARE\Node.js' -ErrorAction SilentlyContinue $dotnetCoreSDKRegKeyCheck = Get-ItemProperty 'HKLM:\SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost' -ErrorAction SilentlyContinue $dotnetCoreRuntimeRegKeyCheck = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\ASP.NET Core\Runtime Package Store\v2.0\RTM' -ErrorAction SilentlyContinue @@ -15,7 +19,7 @@ function CheckIfElevated() $IsAdmin=$prp.IsInRole($adm) if ($IsAdmin) { - Write-Host "Verified - PowerShell is running in Admin mode" + Write-Host "Verified - PowerShell is running in Admin mode" return $true } else @@ -32,7 +36,7 @@ function CheckIfUnrestricted() Write-Host "Checking if PowerShell is running with Unrestricted execution policy..." $executionPolicy = Get-ExecutionPolicy if($executionPolicy -eq "Unrestricted") { - Write-Host "Verified - PowerShell Execution Policy is set to Unrestricted" + Write-Host "Verified - PowerShell Execution Policy is set to Unrestricted" return $true } else { @@ -77,12 +81,7 @@ function invoke-download(){ } } -if(!(CheckIfElevated)) -{ - exit -} - -if(!(CheckIfUnrestricted)) +if(!(CheckIfElevated) -or !(CheckIfUnrestricted)) { exit } @@ -112,4 +111,24 @@ if($dotnetCoreRuntimeRegKeyCheck) { else { Write-Output "Downloading and installing Dotnet Core Runtime" invoke-download($dotnetCoreRuntimeUrl) ("DotnetCoreRuntime") -} \ No newline at end of file +} + +# assuming the script is running from Sia-Root directory +# moving up one level above and going back to reposDir +$reposDir = Split-Path (Get-Location).Path +Push-Location $reposDir + +if (Test-Path Sia-EventUI) { + Write-Output "Removing existing Sia-EventUI folder..." + Remove-Item Sia-EventUI -Recurse -Force -ErrorAction Ignore +} + +git clone https://github.com/Azure/Sia-EventUI.git +Push-Location Sia-EventUI + +npm install + +Copy-Item cfg\constExample.js cfg\localhost.const.js -Recurse -Force + +Write-Output "`nSIA-EventUI is now installed with the rerequisites and cloned with the repos." +Write-Output "You may now start the UI with 'npm start', and then open http://localhost:3000 in your browser.`n" \ No newline at end of file