Files
Reims-Go/opencore_flow.go
T
NwflowerandClaude Opus 5.5 331d0748a4 refactor(vmstart): share VM start preparation between GUI and CLI
New internal/vmstart holds the steps both front ends need: commit-memory
precheck, offline helper disk, recovery boot picker, guest-language replay,
WHPX nested-virt compatibility, and P-core pinning after start. app.go's
StartVM and the CLI's "vm start" / "vm create --start" (cmd/reims-go/start.go)
call it, replacing memcheck.go and the copies in install/opencore flows.
"vm start" now refuses a VM that is already running instead of rewriting its
OpenCore image. Guest Tools bridging and the Win10 cold-reboot watcher still
need a long-lived process and stay GUI-only (architecture.md 3.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 10:51:23 -07:00

35 lines
1.1 KiB
Go

package main
import (
"github.com/Nwflower/reims-go/internal/driver/reims"
"github.com/Nwflower/reims-go/internal/opencore"
"github.com/Nwflower/reims-go/internal/vmstart"
)
// populateGuestLangDetail fills VMDetail.GuestLang from the VM's persisted
// sidecar preference, falling back to reading prev-lang:kbd directly from its
// OpenCore image so existing VMs accurately reflect their boot/recovery locale.
func (a *App) populateGuestLangDetail(d *reims.VMDetail) {
if d == nil || d.Directory == "" {
return
}
if saved := opencore.ReadSavedGuestLang(d.Directory); saved != "" {
d.GuestLang = saved
return
}
if ocPath := opencore.ResolveOpenCorePath(d.Directory); ocPath != "" {
if lang, err := opencore.ReadImagePrevLang(ocPath); err == nil && lang != "" {
d.GuestLang = lang
}
}
}
// prep returns the shared start/OpenCore helpers (internal/vmstart) for one VM,
// logging to that VM's log panel.
func (a *App) prep(name string) (*vmstart.Prep, error) {
a.mu.Lock()
cfg := *a.cfg
a.mu.Unlock()
return vmstart.New(cfg, func(line string) { a.emitLog(name, line) })
}