-
Notifications
You must be signed in to change notification settings - Fork 25
/
applyDeviceTreeOverlays.ps1
62 lines (52 loc) · 1.49 KB
/
applyDeviceTreeOverlays.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
62
#!/usr/bin/env pwsh
param(
[Parameter(Mandatory=$true)]
[string] $login,
[Parameter(Mandatory=$true)]
[string] $pass,
[Parameter(Mandatory=$true)]
[string] $ip,
[Parameter(Mandatory=$true)]
[string] $overlays
)
$errorActionPreference = "Stop"
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', "Internal PS variable"
)]
$PSNativeCommandUseErrorActionPreference = $true
# include
. "$env:HOME/.apollox/scripts/utils/animations.ps1"
. "$env:HOME/.apollox/scripts/utils/stackTrace.ps1"
try {
$dtbList = RunCommandInBackgrounWithWaitAnimation {
param(
[Parameter(Mandatory=$true)]
[string] $login,
[Parameter(Mandatory=$true)]
[string] $pass,
[Parameter(Mandatory=$true)]
[string] $targetIp,
[Parameter(Mandatory=$true)]
[string] $overlays
)
# get it from the apollox lib
node $env:HOME/.apollox/scripts/node/applyDeviceTreeOverlays.mjs `
$targetIp `
$login `
$pass `
$overlays | ConvertFrom-Json
} ($login, $pass, $ip, $overlays)
Write-Host ""
Write-Host "🌳 :: APPLY TREE OVERLAYS :: 🌳"
Write-Host ""
foreach ($_dtb in $dtbList) {
Write-Host "$_dtb"
}
} catch {
Write-Host -ForegroundColor Red `
"`t ❌ :: Could not connect to device :: ❌"
Write-Host ""
ShowStackTrace $_
exit 500
}
Write-Host ""