Skip to content

Commit

Permalink
Resolve symlink path for qemu directory if possible
Browse files Browse the repository at this point in the history
Fixes #17026
Fixes NixOS/nixpkgs#169118

[NO NEW TESTS NEEDED]

Related: NixOS/nixpkgs#163015
Signed-off-by: Nathan Henrie <[email protected]>
  • Loading branch information
n8henrie authored and openshift-cherrypick-robot committed Feb 8, 2023
1 parent f5670f0 commit a1cc373
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 a1cc373

Please sign in to comment.