Skip to content

Commit

Permalink
fix #316: find qemu with platform specific binary
Browse files Browse the repository at this point in the history
  • Loading branch information
abiosoft committed Jun 3, 2022
1 parent 3c03f80 commit a0e5e33
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion daemon/process/gvproxy/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (q qemuShareDirSymlink) Install(host environment.HostActions) error {
return fmt.Errorf("error preparing qemu wrapper shared directory: %w", err)
}

qemu, err := exec.LookPath("qemu-img")
qemu, err := exec.LookPath("qemu-system-" + string(environment.HostArch().Value()))
if err != nil {
return fmt.Errorf("error locating qemu binaries in PATH: %w", err)
}
Expand Down
17 changes: 16 additions & 1 deletion environment/vm/lima/lima.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func (l *limaVM) startDaemon(ctx context.Context, conf config.Config) (context.C
a := l.Init(ctx)
log := l.Logger(ctx)

installedKey := struct{ key string }{key: "installed"}

a.Stage("preparing network")
a.Add(func() error {
ctx = context.WithValue(ctx, ctxKeyGVProxy, true)
Expand All @@ -126,6 +128,7 @@ func (l *limaVM) startDaemon(ctx context.Context, conf config.Config) (context.C
}
deps, root := l.daemon.Dependencies(ctx)
if deps.Installed() {
ctx = context.WithValue(ctx, installedKey, true)
return nil
}

Expand All @@ -135,7 +138,13 @@ func (l *limaVM) startDaemon(ctx context.Context, conf config.Config) (context.C
log.Println("dependencies missing for setting up reachable IP address")
log.Println("sudo password may be required")
}
return deps.Install(l.host)

// install deps
err := deps.Install(l.host)
if err != nil {
ctx = context.WithValue(ctx, installedKey, false)
}
return err
})

a.Add(func() error {
Expand Down Expand Up @@ -166,6 +175,12 @@ func (l *limaVM) startDaemon(ctx context.Context, conf config.Config) (context.C
// network failure is not fatal
if err := a.Exec(); err != nil {
func() {
installed, _ := ctx.Value(installedKey).(bool)
if !installed {
log.Warnln(fmt.Errorf("error setting up network dependencies: %w", err))
return
}

status, ok := ctx.Value(statusKey).(daemon.Status)
if !ok {
return
Expand Down

0 comments on commit a0e5e33

Please sign in to comment.