builder/virtualbox: use VBOX_INSTALL_PATH to find VBoxManage
This commit is contained in:
parent
6867c4f3e3
commit
d9c3aed479
|
@ -16,6 +16,8 @@ IMPROVEMENTS:
|
|||
IDs to apply. [GH-499]
|
||||
* builder/amazon/all: AWS API requests are now retried when a temporary
|
||||
network error occurs as well as 500 errors. [GH-559]
|
||||
* builder/virtualbox: Use VBOX\_INSTALL\_PATH env var on Windows to find
|
||||
VBoxManage. [GH-628]
|
||||
* post-processor/vagrant: skips gzip compression when compression_level=0
|
||||
* provisioner/chef-solo: Encrypted data bag support [GH-625]
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
@ -485,9 +486,29 @@ func (b *Builder) Cancel() {
|
|||
}
|
||||
|
||||
func (b *Builder) newDriver() (Driver, error) {
|
||||
vboxmanagePath, err := exec.LookPath("VBoxManage")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var vboxmanagePath string
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
// On Windows, we check VBOX_INSTALL_PATH env var for the path
|
||||
if installPath := os.Getenv("VBOX_INSTALL_PATH"); installPath != "" {
|
||||
log.Printf("[DEBUG] builder/virtualbox: VBOX_INSTALL_PATH: %s",
|
||||
installPath)
|
||||
for _, path := range strings.Split(installPath, ";") {
|
||||
path = filepath.Join(path, "VBoxManage.exe")
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
vboxmanagePath = path
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if vboxmanagePath == "" {
|
||||
var err error
|
||||
vboxmanagePath, err = exec.LookPath("VBoxManage")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("VBoxManage path: %s", vboxmanagePath)
|
||||
|
|
Loading…
Reference in New Issue