forked from espressif/esp-adf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
53 lines (42 loc) · 1.38 KB
/
install.ps1
File metadata and controls
53 lines (42 loc) · 1.38 KB
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
#!/usr/bin/env pwsh
function ExecuteCommand {
param (
[string]$command,
[string]$errorMessage
)
try {
Write-Host "Executing: $command" -ForegroundColor Yellow
Write-Host "===" -ForegroundColor Yellow
Invoke-Expression $command
} catch {
Write-Host "$errorMessage" -ForegroundColor Red
exit 1
}
if ($LASTEXITCODE -ne 0) {
Write-Host "$errorMessage, exit code: $LASTEXITCODE" -ForegroundColor Red
exit 1
}
}
$ORIG_PATH = Get-Location
$ADF_PATH = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$ADF_PATH = $ADF_PATH.TrimEnd([IO.Path]::DirectorySeparatorChar)
if (-not $env:IDF_PATH) {
$env:IDF_PATH = [IO.Path]::Combine($ADF_PATH, "esp-idf")
}
Write-Host "ADF_PATH: $ADF_PATH"
Write-Host "IDF_PATH: $env:IDF_PATH"
Push-Location $env:IDF_PATH
$command = "git submodule update --init --recursive --depth 1"
$errorMessage = "IDF submodules update failed."
ExecuteCommand $command $errorMessage
$installScriptPath = [IO.Path]::Combine($IDF_PATH, "install.ps1")
if (Test-Path $installScriptPath) {
Write-Host "Calling install.ps1..."
$command = '& $installScriptPath'
$errorMessage = "Install idf tools failed."
ExecuteCommand $command $errorMessage
} else {
Write-Host "install.ps1 not found at path: $installScriptPath" -ForegroundColor Red
exit 1
}
Pop-Location