mirror of
https://github.com/containers/podman.git
synced 2026-10-24 10:49:10 -04:00
Resolve symlink path for qemu directory if possible
Fixes https://github.com/containers/podman/issues/17026 Fixes https://github.com/NixOS/nixpkgs/issues/169118 [NO NEW TESTS NEEDED] Related: https://github.com/NixOS/nixpkgs/pull/163015 Signed-off-by: Nathan Henrie <nate@n8henrie.com>
This commit is contained in:
1 parent
93a36687ab
commit
6b6458916e
1 file changed
+16
-6
@@ -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 ""
|
||||
}
|
||||
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 sharePath(symlinkedPath)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user