Skip to content

Commit 1bde07e

Browse files
Merge pull request #17429 from openshift-cherrypick-robot/cherry-pick-17027-to-v4.4
[v4.4] Resolve symlink path for qemu directory if possible
2 parents 393336b + a1cc373 commit 1bde07e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pkg/machine/qemu/options_darwin_arm64.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,23 @@ func getOvmfDir(imagePath, vmName string) string {
4646
*/
4747
func getEdk2CodeFdPathFromQemuBinaryPath() string {
4848
cfg, err := config.Default()
49-
if err == nil {
50-
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
51-
if err == nil {
52-
return filepath.Clean(filepath.Join(filepath.Dir(execPath), "..", "share", "qemu"))
53-
}
49+
if err != nil {
50+
return ""
51+
}
52+
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
53+
if err != nil {
54+
return ""
55+
}
56+
57+
sharePath := func(path string) string {
58+
return filepath.Clean(filepath.Join(filepath.Dir(path), "..", "share", "qemu"))
59+
}
60+
61+
symlinkedPath, err := filepath.EvalSymlinks(execPath)
62+
if err != nil {
63+
return sharePath(execPath)
5464
}
55-
return ""
65+
return sharePath(symlinkedPath)
5666
}
5767

5868
/*

0 commit comments

Comments
 (0)