diff --git a/Makefile b/Makefile index 75b8a19dbf..634940dc57 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ ETCDIR ?= ${PREFIX}/etc TMPFILESDIR ?= ${PREFIX}/lib/tmpfiles.d SYSTEMDDIR ?= ${PREFIX}/lib/systemd/system USERSYSTEMDDIR ?= ${PREFIX}/lib/systemd/user +GVPROXY_PATH ?= /usr/libexec/gvproxy REMOTETAGS ?= remote exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp BUILDTAGS ?= \ $(shell hack/apparmor_tag.sh) \ @@ -90,11 +91,13 @@ else BUILD_INFO ?= $(shell date "+$(DATE_FMT)") ISODATE ?= $(shell date --iso-8601) endif -LIBPOD := ${PROJECT}/v3/libpod +MODULE ?= $(shell grep -m1 ^module go.mod | cut -d\ -f2) +LIBPOD := ${MODULE}/libpod GOFLAGS ?= -trimpath LDFLAGS_PODMAN ?= \ -X $(LIBPOD)/define.gitCommit=$(GIT_COMMIT) \ -X $(LIBPOD)/define.buildInfo=$(BUILD_INFO) \ + -X $(MODULE)/pkg/machine.ForwarderBinaryPath=$(GVPROXY_PATH) \ -X $(LIBPOD)/config._installPrefix=$(PREFIX) \ -X $(LIBPOD)/config._etcDir=$(ETCDIR) \ $(EXTRA_LDFLAGS) diff --git a/pkg/machine/config.go b/pkg/machine/config.go index cad71ba490..926009c870 100644 --- a/pkg/machine/config.go +++ b/pkg/machine/config.go @@ -34,7 +34,7 @@ var ( ErrVMAlreadyExists = errors.New("VM already exists") ErrVMAlreadyRunning = errors.New("VM already running") ErrMultipleActiveVM = errors.New("only one VM can be active at a time") - ForwarderBinaryName = "gvproxy" + ForwarderBinaryPath string // Populated by Makefile ) type Download struct { diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 855a39c56c..6e03deecbe 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -622,9 +622,10 @@ 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) + + binary := machine.ForwarderBinaryPath if _, err := os.Stat(binary); err != nil { + fmt.Println("Failed to find " + binary + ". Perhaps build using `make GVPROXY+PATH=...`") return err }