Commit c0f9dbde authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox: search VBOX_MSI_INSTALL_PATH [GH-1337]

parent f0bc4fd0
...@@ -33,6 +33,8 @@ BUG FIXES: ...@@ -33,6 +33,8 @@ BUG FIXES:
* builder/parallels/all: Added some navigation keys [GH-1442] * builder/parallels/all: Added some navigation keys [GH-1442]
* builder/qemu: If headless, sdl display won't be used. [GH-1395] * builder/qemu: If headless, sdl display won't be used. [GH-1395]
* builder/qemu: Use `512M` as `-m` default. [GH-1444] * builder/qemu: Use `512M` as `-m` default. [GH-1444]
* builder/virtualbox/all: Search `VBOX_MSI_INSTALL_PATH` for path to
`VBoxManage` on Windows. [GH-1337]
* builder/virtualbox/all: Seed RNG to avoid same ports. [GH-1386] * builder/virtualbox/all: Seed RNG to avoid same ports. [GH-1386]
* builder/virtualbox/all: Better error if guest additions URL couldn't be * builder/virtualbox/all: Better error if guest additions URL couldn't be
detected. [GH-1439] detected. [GH-1439]
......
...@@ -55,15 +55,16 @@ func NewDriver() (Driver, error) { ...@@ -55,15 +55,16 @@ func NewDriver() (Driver, error) {
// On Windows, we check VBOX_INSTALL_PATH env var for the path // On Windows, we check VBOX_INSTALL_PATH env var for the path
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
if installPath := os.Getenv("VBOX_INSTALL_PATH"); installPath != "" { vars := []string{"VBOX_INSTALL_PATH", "VBOX_MSI_INSTALL_PATH"}
log.Printf("[DEBUG] builder/virtualbox: VBOX_INSTALL_PATH: %s", for _, key := range vars {
installPath) value := os.Getenv(key)
for _, path := range strings.Split(installPath, ";") { if value != "" {
path = filepath.Join(path, "VBoxManage.exe") log.Printf(
if _, err := os.Stat(path); err == nil { "[DEBUG] builder/virtualbox: %s = %s", key, value)
vboxmanagePath = path vboxmanagePath = findVBoxManageWindows(value)
break }
} if vboxmanagePath != "" {
break
} }
} }
} }
...@@ -84,3 +85,14 @@ func NewDriver() (Driver, error) { ...@@ -84,3 +85,14 @@ func NewDriver() (Driver, error) {
return driver, nil return driver, nil
} }
func findVBoxManageWindows(paths string) string {
for _, path := range strings.Split(paths, ";") {
path = filepath.Join(path, "VBoxManage.exe")
if _, err := os.Stat(path); err == nil {
return path
}
}
return ""
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment