# Particle-OS Compilation Script for Windows PowerShell # This script compiles all Particle-OS tools using WSL Write-Host "========================================" -ForegroundColor Cyan Write-Host "Particle-OS Compilation for Windows" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan # Check if WSL is available try { $wslVersion = wsl --version 2>$null if ($LASTEXITCODE -ne 0) { throw "WSL not available" } } catch { Write-Host "ERROR: WSL is not installed or not available" -ForegroundColor Red Write-Host "Please install WSL first: https://docs.microsoft.com/en-us/windows/wsl/install" -ForegroundColor Yellow Read-Host "Press Enter to exit" exit 1 } # Function to compile a component function Compile-Component { param( [string]$ComponentName, [string]$Path ) Write-Host "`nCompiling $ComponentName..." -ForegroundColor Green $command = "cd /mnt/c/Users/rob/Documents/Projects/Particle-OS/tools/src/$Path && ./compile.sh" $result = wsl bash -c $command 2>&1 if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: Failed to compile $ComponentName" -ForegroundColor Red Write-Host "Output: $result" -ForegroundColor Yellow return $false } Write-Host "✓ $ComponentName compiled successfully" -ForegroundColor Green return $true } # Compile all components $components = @( @{Name="apt-layer"; Path="apt-layer"}, @{Name="composefs"; Path="composefs"}, @{Name="bootc"; Path="bootc"}, @{Name="bootupd"; Path="bootupd"} ) $success = $true foreach ($component in $components) { if (-not (Compile-Component -ComponentName $component.Name -Path $component.Path)) { $success = $false break } } if ($success) { Write-Host "`n========================================" -ForegroundColor Cyan Write-Host "Compilation completed successfully!" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Cyan Write-Host "`nNext steps:" -ForegroundColor Yellow Write-Host "1. Copy the compiled scripts to your VM" -ForegroundColor White Write-Host "2. Run the fix scripts on your VM" -ForegroundColor White Write-Host "3. Test the system" -ForegroundColor White } else { Write-Host "`n========================================" -ForegroundColor Red Write-Host "Compilation failed!" -ForegroundColor Red Write-Host "========================================" -ForegroundColor Red } Read-Host "`nPress Enter to exit"