$ErrorActionPreference = "Stop" $ProjectRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $AssetRoot = Join-Path $ProjectRoot "apps\desktop\src-tauri\resources\netclient" $Curl = Get-Command curl.exe -ErrorAction SilentlyContinue if (-not $Curl) { $Curl = Get-Command curl -ErrorAction Stop } $Assets = @( @{ Url = "https://fileserver.netmaker.io/releases/download/latest/netclientbundle.exe" Path = "windows\netclientbundle.exe" }, @{ Url = "https://fileserver.netmaker.io/releases/download/latest/netclient-windows-amd64.exe" Path = "windows\netclient-windows-amd64.exe" }, @{ Url = "https://fileserver.netmaker.io/releases/download/latest/Netclient-M1.pkg" Path = "macos\Netclient-M1.pkg" }, @{ Url = "https://fileserver.netmaker.io/releases/download/latest/Netclient-Intel.pkg" Path = "macos\Netclient-Intel.pkg" }, @{ Url = "https://fileserver.netmaker.io/releases/download/latest/netclient-darwin-arm64" Path = "macos\netclient-darwin-arm64" }, @{ Url = "https://fileserver.netmaker.io/releases/download/latest/netclient-darwin-amd64" Path = "macos\netclient-darwin-amd64" } ) New-Item -ItemType Directory -Force -Path (Join-Path $AssetRoot "windows") | Out-Null New-Item -ItemType Directory -Force -Path (Join-Path $AssetRoot "macos") | Out-Null foreach ($Asset in $Assets) { $Target = Join-Path $AssetRoot $Asset.Path $TargetDir = Split-Path -Parent $Target New-Item -ItemType Directory -Force -Path $TargetDir | Out-Null Write-Host "Downloading $($Asset.Url)" & $Curl.Source -L --fail --retry 3 --retry-delay 2 -o $Target $Asset.Url } $MacBinaries = @( (Join-Path $AssetRoot "macos\netclient-darwin-arm64"), (Join-Path $AssetRoot "macos\netclient-darwin-amd64") ) foreach ($Binary in $MacBinaries) { if (Test-Path $Binary) { try { chmod +x $Binary } catch { Write-Host "Skip chmod on $Binary" } } } Write-Host "Netclient assets are ready in $AssetRoot"