Skip to content

Commit

Permalink
Merge pull request #17429 from openshift-cherrypick-robot/cherry-pick…
Browse files Browse the repository at this point in the history
…-17027-to-v4.4

[v4.4] Resolve symlink path for qemu directory if possible
  • Loading branch information
openshift-merge-robot authored Feb 8, 2023
2 parents 393336b + a1cc373 commit 1bde07e
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions pkg/machine/qemu/options_darwin_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ func getOvmfDir(imagePath, vmName string) string {
*/
func getEdk2CodeFdPathFromQemuBinaryPath() string {
cfg, err := config.Default()
if err == nil {
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
if err == nil {
return filepath.Clean(filepath.Join(filepath.Dir(execPath), "..", "share", "qemu"))
}
if err != nil {
return ""
}
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
if err != nil {
return ""
}

sharePath := func(path string) string {
return filepath.Clean(filepath.Join(filepath.Dir(path), "..", "share", "qemu"))
}

symlinkedPath, err := filepath.EvalSymlinks(execPath)
if err != nil {
return sharePath(execPath)
}
return ""
return sharePath(symlinkedPath)
}

/*
Expand Down

0 comments on commit 1bde07e

Please sign in to comment.