Files
Reims-Go/install_flow.go
T
NwflowerandClaude Opus 5.5 3f8cf11d3d feat: offline install flow, installer page, commit-memory checks (v0.2)
- New VMs default to an offline installer of one exact release
  (`reims-ctl create --macos <ver> --offline --network false`); the wizard
  lists Apple's releases, marks downloaded ones and warns when space is short.
- Offline VMs get an install guide with the install-macos.sh command and a
  "Finish install" action that ejects the installer and turns the network on
  (FinishInstall; pending until the next start on a running VM).
- Installers page (roadmap M2.2): downloaded installers with resume/delete,
  Apple's releases with download, progress and pause, space check first.
- Commit memory: the host report carries Windows' commit limit and available
  commit; create/settings refuse memory over the limit, start refuses memory
  that can't be committed now with a clear message, and the wizard, settings
  and first launch show a recommended size (16G failed with 14.7 GiB free).
- First launch shows a host check (WHPX with enable, Vulkan GPU, memory)
  before the runtime install.
- Create validation rejects a VM name that already exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 05:09:50 -07:00

71 lines
1.9 KiB
Go

package main
// Finishing an offline install (roadmap M2.3): take the installer out and turn
// the network back on, which an offline install keeps off so its installer
// downloads no update (`reims-ctl create --help`, upstream 3731afd).
import (
"context"
"github.com/Nwflower/reims-go/internal/driver/reims"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
)
// FinishInstall ejects the installer and enables the network. Both changes
// apply at the VM's next start (a running VM keeps its installer until then:
// `reims-ctl eject --help`), so on a running VM they are listed as pending.
func (a *App) FinishInstall(name string) error {
c, err := a.client()
if err != nil {
return err
}
d, err := a.GetVMDetail(name)
if err != nil {
return err
}
w := &logWriter{emit: func(line string) { a.emitLog(name, line) }}
ctx := context.Background()
if d.HasInstaller {
a.emitLog(name, "Ejecting installer from "+name+"...")
if err := c.Eject(ctx, name, w, w); err != nil {
return err
}
}
if !d.Network {
on := true
a.emitLog(name, "Turning the network on for "+name+"...")
if err := c.Set(ctx, reims.SetOpts{Name: name, Network: &on}, w, w); err != nil {
return err
}
}
running := d.State == "running"
if !running {
if list, err := c.List(ctx); err == nil {
for _, vm := range list {
if vm.Name == name {
running = vm.State == "running"
}
}
}
}
if running {
var diffs []PendingChange
if d.HasInstaller {
diffs = append(diffs, PendingChange{Field: "installer", From: "attached", To: "ejected"})
}
if !d.Network {
diffs = append(diffs, PendingChange{Field: "network", From: "off", To: "on"})
}
a.mu.Lock()
a.pendingChanges[name] = append(a.pendingChanges[name], diffs...)
a.mu.Unlock()
}
a.emitLog(name, "Install finished: installer out, network on")
if a.ctx != nil {
wailsRuntime.EventsEmit(a.ctx, "reims:state-changed", true)
}
return nil
}