-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSetup.ps1
61 lines (40 loc) · 1.65 KB
/
Setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# GET IP
$networkAdapters = Get-NetAdapter -Physical | Where-Object { $_.Status -eq "Up" } | Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -notlike "127.0.0.*" }
$mainAdapter = $networkAdapters | Where-Object { $_.InterfaceIndex -eq (Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Sort-Object -Property RouteMetric | Select-Object -First 1).InterfaceIndex }
# CHECK SYSTEM PREREQUISITES FUNCTION
function Check-Program {
param (
[string]$program
)
if (-not (Get-Command $program -ErrorAction SilentlyContinue)) {
Write-Host "$program could not be found, please install it."
exit 1
}
}
# BEGIN SCRIPT AND CHECK DEPENDENCIES
Write-Host "hello, world!"
Write-Host "running on ip: $($mainAdapter.IPAddress)"
Write-Host "`nchecking platform dependencies"
Check-Program "node"
Check-Program "npm"
Check-Program "git"
Check-Program "python"
Write-Host "all dependencies are installed!`n"
Write-Host "`ports ready, starting config now`n"
Set-Location gateway
python -m venv venv > $null
. .\venv\Scripts\Activate.ps1 > $null
python.exe -m pip install --upgrade pip > $null
pip install -r requirements.txt
deactivate
Set-Location ..
Write-Host "`ngateway setup complete`n"
Write-Host "setting up lmcc client"
Set-Location client
npm install -g typescript > $null 2>&1
npm install > $null 2>&1
Set-Location ..
Write-Host "`nlmcc client setup complete"
Write-Host "`nlmcc application setup complete"
Write-Host "`nclient will run on http://$($mainAdapter.IPAddress):3000`nserver will be run on http://$($mainAdapter.IPAddress):3001`nshare these urls for testing on the same network"
Write-Host "`ngoodbye, world."