From e91c4de7edfcb8f7323a6b308ab41a0925581f5a Mon Sep 17 00:00:00 2001 From: sysadmin Date: Wed, 10 Jun 2026 22:44:05 +0100 Subject: [PATCH] fix(apps): winget bootstrap never ran (unbalanced-brace parse error in inline cmd) appinstall.log on the VM showed: bootstrap-winget exit=1 'Unexpected token }'. The inline -Command was built from an interpolated string ($"...{{...}}" -> {/}) concatenated with a NON-interpolated string whose '}}' stayed literal, so the emitted PowerShell ended in '}}' and failed to parse -> the bootstrap (and thus winget install) never executed -> all apps skipped on every run, regardless of network. Invoke the bootstrap .ps1 file directly instead (it self-checks + installs winget online); fall back to the inbox re-register only when the script is absent. Co-Authored-By: Claude Opus 4.8 --- .../src/SilverOS.Welcome.Core/Apps/AppInstaller.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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)}");