mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-21 15:57:54 +00: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:
parent
f5670f01c9
commit
a1cc3733b1
1 changed files with 16 additions and 6 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue