Skip to content

Commit a1cc373

Browse files
n8henrieopenshift-cherrypick-robot
authored and
openshift-cherrypick-robot
committed
Resolve symlink path for qemu directory if possible
Fixes #17026 Fixes NixOS/nixpkgs#169118 [NO NEW TESTS NEEDED] Related: NixOS/nixpkgs#163015 Signed-off-by: Nathan Henrie <[email protected]>
1 parent f5670f0 commit a1cc373

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)