diff --git a/windows/welcome/src/SilverOS.Welcome.Core/Apps/AppInstaller.cs b/windows/welcome/src/SilverOS.Welcome.Core/Apps/AppInstaller.cs index f35b8e0..2a11f2a 100644 --- a/windows/welcome/src/SilverOS.Welcome.Core/Apps/AppInstaller.cs +++ b/windows/welcome/src/SilverOS.Welcome.Core/Apps/AppInstaller.cs @@ -79,13 +79,17 @@ public sealed class AppInstaller(IProcessRunner runner, string appsDir) : IAppIn Log($"winget probe (PATH): exit={p1.ExitCode} out={Snip(p1.StdOut)}"); if (p1.ExitCode == 0) return "winget"; - // 2) Provision App Installer via the bundled bootstrap (or registered package), then re-probe. + // 2) Provision App Installer, then re-probe. Run the bootstrap SCRIPT FILE directly + // (it checks for winget and installs it online if absent). Invoking the .ps1 file + // avoids an inline -Command (a prior inline if/else had an unbalanced-brace parse bug + // from a non-interpolated string, so the bootstrap never actually ran). progress.Report(new("Preparing app installer", 68)); var bootstrap = Path.Combine(appsDir, "bootstrap-winget.ps1"); - var b = await TryRunAsync("powershell.exe", - $"-NoProfile -ExecutionPolicy Bypass -Command \"if (Test-Path '{bootstrap}') {{ & '{bootstrap}' }} else {{ " + - "Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe -EA SilentlyContinue }}\"", - ct); + var b = File.Exists(bootstrap) + ? await TryRunAsync("powershell.exe", $"-NoProfile -ExecutionPolicy Bypass -File \"{bootstrap}\"", ct) + : await TryRunAsync("powershell.exe", + "-NoProfile -ExecutionPolicy Bypass -Command \"Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe -EA SilentlyContinue\"", + ct); Log($"bootstrap-winget: exit={b.ExitCode} out={Snip(b.StdOut)} err={Snip(b.StdErr)}"); var p2 = await TryRunAsync("winget", "--version", ct); Log($"winget probe (post-bootstrap): exit={p2.ExitCode} out={Snip(p2.StdOut)}");