Skip to content

Commit

Permalink
fix gvproxy path search for macos
Browse files Browse the repository at this point in the history
macos does not have /usr/libexec/ so we look in the executable paths
first.

Fixes: containers#11226

[NO TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
  • Loading branch information
baude committed Aug 16, 2021
1 parent a5adadf commit 440188f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/machine/qemu/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,15 @@ func CheckActiveVM() (bool, string, error) {
// startHostNetworking runs a binary on the host system that allows users
// to setup port forwarding to the podman virtual machine
func (v *MachineVM) startHostNetworking() error {
// TODO we may wish to configure the directory in containers common
binary := filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName)
if _, err := os.Stat(binary); err != nil {
return err
// MacOS does not have /usr/libexec so we look in the executable
// paths.
binary, err := exec.LookPath(machine.ForwarderBinaryName)
if errors.Cause(err) == exec.ErrNotFound {
// Nothing was found, so now check /usr/libexec, else error out
binary = filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName)
if _, err := os.Stat(binary); err != nil {
return err
}
}

// Listen on all at port 7777 for setting up and tearing
Expand Down

0 comments on commit 440188f

Please sign in to comment.