Files
cydweb/scripts/sync-firmware.ps1
DESKTOP-PUHFO60\dsx2016 ae63378fdb Add CYD browser flasher with Next.js, i18n, and Web Serial install.
Replace the starter app with a public/local flasher that discovers sibling firmwares, supports en/zh, and documents HTTPS deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 19:38:53 +08:00

38 lines
1.2 KiB
PowerShell

# Mirror sibling project firmware archives into cydweb/firmware for public deploy.
# Usage (from cydweb):
# .\scripts\sync-firmware.ps1
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
$cydRoot = Split-Path -Parent $root
$dstRoot = Join-Path $root "firmware"
New-Item -ItemType Directory -Force -Path $dstRoot | Out-Null
$required = @("bootloader.bin", "partitions.bin", "boot_app0.bin", "firmware.bin")
$count = 0
Get-ChildItem $cydRoot -Directory | Where-Object { $_.Name -ne "cydweb" } | ForEach-Object {
$proj = $_.Name
$fwRoot = Join-Path $_.FullName "firmware"
if (-not (Test-Path $fwRoot)) { return }
Get-ChildItem $fwRoot -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$variant = $_.Name
$src = $_.FullName
$ok = $true
foreach ($f in $required) {
if (-not (Test-Path (Join-Path $src $f))) { $ok = $false; break }
}
if (-not $ok) { return }
$dst = Join-Path $dstRoot (Join-Path $proj $variant)
New-Item -ItemType Directory -Force -Path $dst | Out-Null
Copy-Item (Join-Path $src "*") $dst -Force -Recurse
Write-Host "Synced $proj/$variant"
$script:count++
}
}
Write-Host "Done. $count firmware package(s) -> $dstRoot"